-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved -on-component tests with {{some-component}} and test helpers
- Loading branch information
Showing
9 changed files
with
73 additions
and
53 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Ember from 'ember'; | ||
|
||
// empty component used for `-on-component` tests | ||
export default Ember.Component.extend({ | ||
classNames: 'some-component', | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-tooltips/components/some-component'; |
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
32 changes: 17 additions & 15 deletions
32
tests/integration/components/popover/popover-on-component-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,31 +1,33 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { assertNotRendered, assertRendered } from '../../../helpers/sync/assert-visibility'; | ||
|
||
moduleForComponent('popover-on-component', 'Integration | Component | popover on component', { | ||
integration: true | ||
}); | ||
|
||
test('popover-on-component renders with no content', function(assert) { | ||
test('popover-on-component does render when enableLazyRendering=false', function(assert) { | ||
|
||
this.render(hbs`{{popover-on-component}}`); | ||
|
||
assert.equal(this.$().text().trim(), '', | ||
'Should render with no content'); | ||
this.render(hbs` | ||
{{#some-component}} | ||
{{#popover-on-component enableLazyRendering=false}} | ||
template block text | ||
{{/popover-on-component}} | ||
{{/some-component}} | ||
`); | ||
|
||
assertRendered(assert, this); | ||
}); | ||
|
||
test('popover-on-component renders with content', function(assert) { | ||
test('popover-on-component does initially render when enableLazyRendering=true', function(assert) { | ||
|
||
this.render(hbs` | ||
{{#popover-on-component}} | ||
template block text | ||
{{/popover-on-component}} | ||
{{#some-component}} | ||
{{#popover-on-component enableLazyRendering=true}} | ||
template block text | ||
{{/popover-on-component}} | ||
{{/some-component}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text', | ||
'Should render with content'); | ||
|
||
assert.ok(this.$().find('.ember-popover').length, | ||
'Should create a popover element'); | ||
|
||
assertNotRendered(assert, this); | ||
}); |
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
32 changes: 17 additions & 15 deletions
32
tests/integration/components/tooltip-on-component-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,31 +1,33 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { assertNotRendered, assertRendered } from '../../helpers/sync/assert-visibility'; | ||
|
||
moduleForComponent('tooltip-on-component', 'Integration | Component | tooltip on component', { | ||
integration: true | ||
}); | ||
|
||
test('tooltip-on-component renders with no content', function(assert) { | ||
test('tooltip-on-component does render when enableLazyRendering=false', function(assert) { | ||
|
||
this.render(hbs`{{tooltip-on-component}}`); | ||
|
||
assert.equal(this.$().text().trim(), '', | ||
'Should render with no content'); | ||
this.render(hbs` | ||
{{#some-component}} | ||
{{#tooltip-on-component enableLazyRendering=false}} | ||
template block text | ||
{{/tooltip-on-component}} | ||
{{/some-component}} | ||
`); | ||
|
||
assertRendered(assert, this); | ||
}); | ||
|
||
test('tooltip-on-component renders with content', function(assert) { | ||
test('tooltip-on-component does initially render when enableLazyRendering=true', function(assert) { | ||
|
||
this.render(hbs` | ||
{{#tooltip-on-component}} | ||
template block text | ||
{{/tooltip-on-component}} | ||
{{#some-component}} | ||
{{#tooltip-on-component enableLazyRendering=true}} | ||
template block text | ||
{{/tooltip-on-component}} | ||
{{/some-component}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text', | ||
'Should render with content'); | ||
|
||
assert.ok(this.$().find('.ember-tooltip').length, | ||
'Should create a tooltip element'); | ||
|
||
assertNotRendered(assert, this); | ||
}); |
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