-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
94 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import DragulaContainer from '@zestia/ember-dragula/components/dragula-container'; | ||
|
||
module('Integration | Component | dragula container', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it sends an action when inserted into the dom', async function (assert) { | ||
assert.expect(1); | ||
|
||
const handleInserted = (element) => | ||
assert.ok(element instanceof HTMLElement); | ||
|
||
const handleDestroyed = () => {}; | ||
|
||
await render(<template> | ||
<DragulaContainer | ||
@onInsert={{handleInserted}} | ||
@onDestroy={{handleDestroyed}} | ||
/> | ||
</template>); | ||
}); | ||
|
||
test('it sends a destroy action when removed from the dom', async function (assert) { | ||
assert.expect(1); | ||
|
||
const state = new (class { | ||
@tracked renderComponent = true; | ||
})(); | ||
|
||
const handleInserted = () => {}; | ||
|
||
const handleDestroyed = (element) => | ||
assert.ok(element instanceof HTMLElement); | ||
|
||
await render(<template> | ||
{{#if state.renderComponent}} | ||
<DragulaContainer | ||
@onDestroy={{handleDestroyed}} | ||
@onInsert={{handleInserted}} | ||
/> | ||
{{/if}} | ||
</template>); | ||
|
||
state.renderComponent = false; | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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