-
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.
Merge pull request #8 from sir-dunxalot/feature/destroy-tooltip
Feature/destroy tooltip
- Loading branch information
Showing
10 changed files
with
99 additions
and
5 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
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
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,54 @@ | ||
import Ember from 'ember'; | ||
import { module, test } from 'qunit'; | ||
import selectorFor from '../helpers/selector-for'; | ||
import startApp from '../helpers/start-app'; | ||
|
||
var application; | ||
|
||
module('Acceptance | destroy on transition', { | ||
beforeEach: function() { | ||
application = startApp(); | ||
}, | ||
|
||
afterEach: function() { | ||
Ember.run(application, 'destroy'); | ||
} | ||
}); | ||
|
||
test('visiting /destroy-on-transition', function(assert) { | ||
const tooltip = 'show-on-click'; | ||
|
||
assert.expect(9); | ||
|
||
visit('/destroy-on-transition'); | ||
|
||
andThenAfterRender(function() { | ||
assert.equal(currentURL(), '/destroy-on-transition', | ||
'Should be on correct route'); | ||
|
||
assertTooltipProperties(assert, tooltip, { | ||
content: 'Should be removed on transition', | ||
event: 'click', | ||
}); | ||
|
||
}); | ||
|
||
click(selectorFor(tooltip)); | ||
|
||
andThenAfterRender(function() { | ||
|
||
assert.ok(inspect(tooltip).length, | ||
'The tooltip should be in the DOM'); | ||
|
||
}); | ||
|
||
visit('/'); | ||
|
||
andThen(function() { | ||
|
||
assert.ok(inspect(tooltip).length === 0, | ||
'The tooltip should not be in the DOM after a route transition'); | ||
|
||
}); | ||
|
||
}); |
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,13 @@ | ||
<h2>Tooltips on helpers</h2> | ||
|
||
<ul class="examples"> | ||
|
||
<li> | ||
{{test-component | ||
tooltipContent='Should be removed on transition' | ||
tooltipEvent='click' | ||
data-test='show-on-click' | ||
}} | ||
</li> | ||
|
||
</ul> |
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,9 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Test.registerAsyncHelper('andThenAfterRender', | ||
function(app, callback) { | ||
andThen(function() { | ||
Ember.run.scheduleOnce('afterRender', this, callback); | ||
}); | ||
} | ||
); |
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