Skip to content

Commit

Permalink
Add test case for tested modules
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnerd committed Feb 9, 2017
1 parent 43d5b3b commit 19cf6b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domodule",
"version": "5.0.1",
"version": "5.0.2",
"description": "Class based modules",
"main": "dist/domodule.js",
"module": "lib/domodule.js",
Expand Down
11 changes: 9 additions & 2 deletions test/domodule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ test('required named', assert => {
const container = document.getElementById('domodule');
container.innerHTML = `
<div id="ExampleModule" data-module="Example" data-module-test="true" data-module-title="Example Module" data-module-global-screen="screen">
<div data-action="testMouseOver" data-action-type="mouseover" style="height: 100px; width: 100px; background: black"></div>
<div data-action="testMouseOver" data-action-type="mouseover" style="height: 100px; width: 100px; background: black"></div>
<span data-name="spanme"></span>
<div id="Nested" data-module="Nested">
<button type="button" data-action="nestedAction">NESTED BUTTON</button>
</div>
</div>
</div>
`;

assert.throws(Domodule.discover, /tester is required as named for Example, but is missing!/, 'Should throw if required named is missing');
Expand All @@ -189,3 +189,10 @@ test('required option', assert => {
assert.throws(Domodule.discover, /important is required as options for Example, but is missing!/, 'Should throw if required option is missing');
assert.end();
});

test('nested modules', assert => {
const modules = setup();
const instance = modules[0];
assert.ok(!instance.find('[data-action="nestedAction"]')[0].dataset.domoduleActionProcessed, 'Nested action not processed');
assert.end();
});

0 comments on commit 19cf6b5

Please sign in to comment.