-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup ember-template-compiler's tests
Fix travis
- Loading branch information
1 parent
4c5344c
commit 1e0128e
Showing
8 changed files
with
153 additions
and
142 deletions.
There are no files selected for viewing
23 changes: 12 additions & 11 deletions
23
packages/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: assert-input-helper-without-block'); | ||
moduleFor('ember-template-compiler: assert-input-helper-without-block', class extends AbstractTestCase { | ||
['@test Using {{#input}}{{/input}} is not valid'](assert) { | ||
assert.expect(1); | ||
|
||
QUnit.test('Using {{#input}}{{/input}} is not valid', function() { | ||
expect(1); | ||
let expectedMessage = | ||
`The {{input}} helper cannot be used in block form. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
let expectedMessage = | ||
`The {{input}} helper cannot be used in block form. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
expectAssertion(() => { | ||
compile('{{#input value="123"}}Completely invalid{{/input}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
expectAssertion(() => { | ||
compile('{{#input value="123"}}Completely invalid{{/input}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
} | ||
}); |
25 changes: 13 additions & 12 deletions
25
packages/ember-template-compiler/tests/plugins/deprecate-render-model-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: deprecate-model-render'); | ||
moduleFor('ember-template-compiler: deprecate-model-render', class extends AbstractTestCase { | ||
['@test Using `{{render` with model provides a deprecation'](assert) { | ||
assert.expect(1); | ||
|
||
QUnit.test('Using `{{render` with model provides a deprecation', function() { | ||
expect(1); | ||
let expectedMessage = | ||
`Please refactor \`{{render "foo-bar" coolModel}}\` to a component and` + | ||
` invoke via \`{{foo-bar model=coolModel}}\`. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
let expectedMessage = | ||
`Please refactor \`{{render "foo-bar" coolModel}}\` to a component and` + | ||
` invoke via \`{{foo-bar model=coolModel}}\`. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
expectDeprecation(() => { | ||
compile('{{render "foo-bar" coolModel}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
expectDeprecation(() => { | ||
compile('{{render "foo-bar" coolModel}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
} | ||
}); |
25 changes: 13 additions & 12 deletions
25
packages/ember-template-compiler/tests/plugins/deprecate-render-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: deprecate-render'); | ||
moduleFor('ember-template-compiler: deprecate-render', class extends AbstractTestCase { | ||
['@test Using `{{render` without a model provides a deprecation'](assert) { | ||
assert.expect(1); | ||
|
||
QUnit.test('Using `{{render` without a model provides a deprecation', function() { | ||
expect(1); | ||
let expectedMessage = | ||
`Please refactor \`{{render "foo-bar"}}\` to a component and` + | ||
` invoke via \`{{foo-bar}}\`. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
let expectedMessage = | ||
`Please refactor \`{{render "foo-bar"}}\` to a component and` + | ||
` invoke via \`{{foo-bar}}\`. ('baz/foo-bar' @ L1:C0) `; | ||
|
||
expectDeprecation(() => { | ||
compile('{{render "foo-bar"}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
expectDeprecation(() => { | ||
compile('{{render "foo-bar"}}', { | ||
moduleName: 'baz/foo-bar' | ||
}); | ||
}, expectedMessage); | ||
} | ||
}); |
41 changes: 21 additions & 20 deletions
41
packages/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: transforms dot component invocation'); | ||
moduleFor('ember-template-compiler: transforms dot component invocation', class extends AbstractTestCase { | ||
['@test Does not throw a compiler error for path components'](assert) { | ||
assert.expect(1); | ||
|
||
QUnit.test('Does not throw a compiler error for path components', function(assert) { | ||
assert.expect(1); | ||
[ | ||
'{{this.modal open}}', | ||
'{{this.modal isOpen=true}}', | ||
'{{#this.modal}}Woot{{/this.modal}}', | ||
'{{c.modal open}}', | ||
'{{c.modal isOpen=true}}', | ||
'{{#c.modal}}Woot{{/c.modal}}', | ||
'{{#my-component as |c|}}{{c.a name="Chad"}}{{/my-component}}', | ||
'{{#my-component as |c|}}{{c.a "Chad"}}{{/my-component}}', | ||
'{{#my-component as |c|}}{{#c.a}}{{/c.a}}{{/my-component}}', | ||
'<input disabled={{true}}>', // GH#15740 | ||
'<td colspan={{3}}></td>' // GH#15217 | ||
].forEach((layout, i) => { | ||
compile(layout, { moduleName: `example-${i}` }); | ||
}); | ||
|
||
[ | ||
'{{this.modal open}}', | ||
'{{this.modal isOpen=true}}', | ||
'{{#this.modal}}Woot{{/this.modal}}', | ||
'{{c.modal open}}', | ||
'{{c.modal isOpen=true}}', | ||
'{{#c.modal}}Woot{{/c.modal}}', | ||
'{{#my-component as |c|}}{{c.a name="Chad"}}{{/my-component}}', | ||
'{{#my-component as |c|}}{{c.a "Chad"}}{{/my-component}}', | ||
'{{#my-component as |c|}}{{#c.a}}{{/c.a}}{{/my-component}}', | ||
'<input disabled={{true}}>', // GH#15740 | ||
'<td colspan={{3}}></td>' // GH#15217 | ||
].forEach((layout, i) => { | ||
compile(layout, { moduleName: `example-${i}` }); | ||
}); | ||
|
||
assert.ok(true); | ||
assert.ok(true); | ||
} | ||
}); |
15 changes: 8 additions & 7 deletions
15
packages/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: assert-no-view-and-controller-paths without legacy view support'); | ||
moduleFor('ember-template-compiler: inline-link-to', class extends AbstractTestCase { | ||
['@test Can transform an inline {{link-to}} without error'](assert) { | ||
assert.expect(0); | ||
|
||
QUnit.test('Can transform an inline {{link-to}} without error', function() { | ||
expect(0); | ||
|
||
compile(`{{link-to 'foo' 'index'}}`, { | ||
moduleName: 'foo/bar/baz' | ||
}); | ||
compile(`{{link-to 'foo' 'index'}}`, { | ||
moduleName: 'foo/bar/baz' | ||
}); | ||
} | ||
}); |
27 changes: 14 additions & 13 deletions
27
packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { compile } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: input type syntax'); | ||
moduleFor('ember-template-compiler: input type syntax', class extends AbstractTestCase { | ||
['@test Can compile an {{input}} helper that has a sub-expression value as its type'](assert) { | ||
assert.expect(0); | ||
|
||
QUnit.test('Can compile an {{input}} helper that has a sub-expression value as its type', function() { | ||
expect(0); | ||
compile(`{{input type=(if true 'password' 'text')}}`); | ||
} | ||
|
||
compile(`{{input type=(if true 'password' 'text')}}`); | ||
}); | ||
|
||
QUnit.test('Can compile an {{input}} helper with a string literal type', function() { | ||
expect(0); | ||
['@test Can compile an {{input}} helper with a string literal type'](assert) { | ||
assert.expect(0); | ||
|
||
compile(`{{input type='text'}}`); | ||
}); | ||
compile(`{{input type='text'}}`); | ||
} | ||
|
||
QUnit.test('Can compile an {{input}} helper with a type stored in a var', function() { | ||
expect(0); | ||
['@test Can compile an {{input}} helper with a type stored in a var'](assert) { | ||
assert.expect(0); | ||
|
||
compile(`{{input type=_type}}`); | ||
compile(`{{input type=_type}}`); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
packages/ember-template-compiler/tests/system/compile_options_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import { compileOptions } from '../../index'; | ||
import { defaultPlugins } from '../../index'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
QUnit.module('ember-template-compiler: default compile options'); | ||
|
||
QUnit.test('default options are a new copy', function() { | ||
notEqual(compileOptions(), compileOptions()); | ||
}); | ||
moduleFor('ember-template-compiler: default compile options', class extends AbstractTestCase { | ||
['@test default options are a new copy'](assert) { | ||
assert.notEqual(compileOptions(), compileOptions()); | ||
} | ||
|
||
QUnit.test('has default AST plugins', function(assert) { | ||
assert.expect(defaultPlugins.length); | ||
['@test has default AST plugins'](assert) { | ||
assert.expect(defaultPlugins.length); | ||
|
||
let plugins = compileOptions().plugins.ast; | ||
let plugins = compileOptions().plugins.ast; | ||
|
||
for (let i = 0; i < defaultPlugins.length; i++) { | ||
let plugin = defaultPlugins[i]; | ||
assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`); | ||
for (let i = 0; i < defaultPlugins.length; i++) { | ||
let plugin = defaultPlugins[i]; | ||
assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`); | ||
} | ||
} | ||
}); |