[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Create dummy platform and target for tests
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/334724 ) Change subject: Create dummy platform and target for tests .. Create dummy platform and target for tests Change-Id: I078c244ef524669da477a43f9b37c847252e5ad7 --- M build/modules.json M tests/index.html D tests/init/ve.init.Platform.test.js M tests/init/ve.init.sa.Platform.test.js M tests/ve.test.utils.js 5 files changed, 107 insertions(+), 87 deletions(-) Approvals: jenkins-bot: Verified Jforrester: Looks good to me, approved diff --git a/build/modules.json b/build/modules.json index 3f1f64c..28c7629 100644 --- a/build/modules.json +++ b/build/modules.json @@ -693,7 +693,6 @@ "tests/ce/ve.ce.LeafNode.test.js", "tests/ce/nodes/ve.ce.TextNode.test.js", "tests/ce/nodes/ve.ce.TableNode.test.js", - "tests/init/ve.init.Platform.test.js", "tests/init/ve.init.sa.Platform.test.js", "tests/ui/ve.ui.DataTransferHandlerFactory.test.js", "tests/ui/ve.ui.Trigger.test.js", diff --git a/tests/index.html b/tests/index.html index bed485d..28f7b36 100644 --- a/tests/index.html +++ b/tests/index.html @@ -494,7 +494,6 @@ - diff --git a/tests/init/ve.init.Platform.test.js b/tests/init/ve.init.Platform.test.js deleted file mode 100644 index 5bdcf36..000 --- a/tests/init/ve.init.Platform.test.js +++ /dev/null @@ -1,74 +0,0 @@ -/*! - * VisualEditor initialization tests. - * - * @copyright 2011-2017 VisualEditor Team and others; see http://ve.mit-license.org - */ - -QUnit.module( 've.init.Platform' ); - -QUnit.asyncTest( 'messages', 4, function ( assert ) { - var platform = ve.init.platform; - - platform.getInitializedPromise().done( function () { - QUnit.start(); - assert.ok( - /^?$/.test( platform.getMessage( 'platformtest-foo' ) ), - 'return plain key as fallback, possibly wrapped in brackets' - ); - - platform.addMessages( { - 'platformtest-foo': 'Foo & Bar by!', - 'platformtest-lorem': 'Lorem <&> Ipsum: $1' - } ); - - assert.strictEqual( - platform.getMessage( 'platformtest-foo' ), - 'Foo & Bar by!', - 'return plain message' - ); - - assert.strictEqual( - platform.getMessage( 'platformtest-lorem', 10 ), - 'Lorem <&> Ipsum: 10', - 'return plain message with $# replacements' - ); - - assert.ok( - /^?$/.test( platform.getMessage( 'platformtest-quux' ) ), - 'return plain key as fallback, possibly wrapped in brackets (after set up)' - ); - } ); -} ); - -QUnit.asyncTest( 'parsedMessage', 3, function ( assert ) { - var platform = ve.init.platform; - - platform.getInitializedPromise().done( function () { - QUnit.start(); - assert.ok( - /^(<)?platformtest-quux(>)?$/.test( platform.getParsedMessage( 'platformtest-quux' ) ), - 'any brackets in fallbacks are HTML-escaped' - ); - - platform.addMessages( { - 'platformtest-foo': 'Foo & Bar by!', - 'platformtest-lorem': 'Lorem <&> Ipsum: $1' - } ); - - platform.addParsedMessages( { - 'platformtest-foo': 'Foo ' - } ); - - assert.strictEqual( - platform.getParsedMessage( 'platformtest-foo' ), - 'Foo ', - 'prefer value from parsedMessage store' - ); - - assert.strictEqual( - platform.getParsedMessage( 'platformtest-lorem', 10 ), - 'Lorem <&> Ipsum: $1', - 'fall back to html-escaped version of plain message, no $# replacements' - ); - } ); -} ); diff --git a/tests/init/ve.init.sa.Platform.test.js b/tests/init/ve.init.sa.Platform.test.js index ae8f87e..ec78099 100644 --- a/tests/init/ve.init.sa.Platform.test.js +++ b/tests/init/ve.init.sa.Platform.test.js @@ -62,3 +62,70 @@ 'multiple values persist' ); } ); + +QUnit.asyncTest( 'messages', 4, function ( assert ) { + var platform = new ve.init.sa.Platform(); + + platform.getInitializedPromise().done( function () { + QUnit.start(); + assert.ok( + /^?$/.
[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Create dummy platform and target for tests
Esanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/334724 ) Change subject: Create dummy platform and target for tests .. Create dummy platform and target for tests Change-Id: I078c244ef524669da477a43f9b37c847252e5ad7 --- M build/modules.json M tests/index.html D tests/init/ve.init.Platform.test.js M tests/init/ve.init.sa.Platform.test.js M tests/ve.test.utils.js 5 files changed, 87 insertions(+), 80 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/24/334724/1 diff --git a/build/modules.json b/build/modules.json index 3f1f64c..28c7629 100644 --- a/build/modules.json +++ b/build/modules.json @@ -693,7 +693,6 @@ "tests/ce/ve.ce.LeafNode.test.js", "tests/ce/nodes/ve.ce.TextNode.test.js", "tests/ce/nodes/ve.ce.TableNode.test.js", - "tests/init/ve.init.Platform.test.js", "tests/init/ve.init.sa.Platform.test.js", "tests/ui/ve.ui.DataTransferHandlerFactory.test.js", "tests/ui/ve.ui.Trigger.test.js", diff --git a/tests/index.html b/tests/index.html index bed485d..28f7b36 100644 --- a/tests/index.html +++ b/tests/index.html @@ -494,7 +494,6 @@ - diff --git a/tests/init/ve.init.Platform.test.js b/tests/init/ve.init.Platform.test.js deleted file mode 100644 index 5bdcf36..000 --- a/tests/init/ve.init.Platform.test.js +++ /dev/null @@ -1,74 +0,0 @@ -/*! - * VisualEditor initialization tests. - * - * @copyright 2011-2017 VisualEditor Team and others; see http://ve.mit-license.org - */ - -QUnit.module( 've.init.Platform' ); - -QUnit.asyncTest( 'messages', 4, function ( assert ) { - var platform = ve.init.platform; - - platform.getInitializedPromise().done( function () { - QUnit.start(); - assert.ok( - /^?$/.test( platform.getMessage( 'platformtest-foo' ) ), - 'return plain key as fallback, possibly wrapped in brackets' - ); - - platform.addMessages( { - 'platformtest-foo': 'Foo & Bar by!', - 'platformtest-lorem': 'Lorem <&> Ipsum: $1' - } ); - - assert.strictEqual( - platform.getMessage( 'platformtest-foo' ), - 'Foo & Bar by!', - 'return plain message' - ); - - assert.strictEqual( - platform.getMessage( 'platformtest-lorem', 10 ), - 'Lorem <&> Ipsum: 10', - 'return plain message with $# replacements' - ); - - assert.ok( - /^?$/.test( platform.getMessage( 'platformtest-quux' ) ), - 'return plain key as fallback, possibly wrapped in brackets (after set up)' - ); - } ); -} ); - -QUnit.asyncTest( 'parsedMessage', 3, function ( assert ) { - var platform = ve.init.platform; - - platform.getInitializedPromise().done( function () { - QUnit.start(); - assert.ok( - /^(<)?platformtest-quux(>)?$/.test( platform.getParsedMessage( 'platformtest-quux' ) ), - 'any brackets in fallbacks are HTML-escaped' - ); - - platform.addMessages( { - 'platformtest-foo': 'Foo & Bar by!', - 'platformtest-lorem': 'Lorem <&> Ipsum: $1' - } ); - - platform.addParsedMessages( { - 'platformtest-foo': 'Foo ' - } ); - - assert.strictEqual( - platform.getParsedMessage( 'platformtest-foo' ), - 'Foo ', - 'prefer value from parsedMessage store' - ); - - assert.strictEqual( - platform.getParsedMessage( 'platformtest-lorem', 10 ), - 'Lorem <&> Ipsum: $1', - 'fall back to html-escaped version of plain message, no $# replacements' - ); - } ); -} ); diff --git a/tests/init/ve.init.sa.Platform.test.js b/tests/init/ve.init.sa.Platform.test.js index ae8f87e..ec78099 100644 --- a/tests/init/ve.init.sa.Platform.test.js +++ b/tests/init/ve.init.sa.Platform.test.js @@ -62,3 +62,70 @@ 'multiple values persist' ); } ); + +QUnit.asyncTest( 'messages', 4, function ( assert ) { + var platform = new ve.init.sa.Platform(); + + platform.getInitializedPromise().done( function () { + QUnit.start(); + assert.ok( +