-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #909 - Fix condition prevent bubbling DOM events from properly …
…being attached to a component. (#910)
- Loading branch information
1 parent
61cb964
commit 9f3dd90
Showing
6 changed files
with
64 additions
and
1 deletion.
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
9 changes: 9 additions & 0 deletions
9
...ts/components-pages/split-emit-multi-args/components/split-component/component-browser.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
onMount: function() { | ||
window.splitComponent = this; | ||
this.clicked = false; | ||
}, | ||
handleClick: function (value) { | ||
this.clicked = value; | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/autotests/components-pages/split-emit-multi-args/components/split-component/index.marko
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 @@ | ||
<button on-click('handleClick', true)/> |
3 changes: 3 additions & 0 deletions
3
test/autotests/components-pages/split-emit-multi-args/marko.json
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,3 @@ | ||
{ | ||
"tags-dir": "./components" | ||
} |
23 changes: 23 additions & 0 deletions
23
test/autotests/components-pages/split-emit-multi-args/template.marko
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,23 @@ | ||
lasso-page dependencies=data.browserDependencies lasso=data.lasso | ||
|
||
<!DOCTYPE html> | ||
html lang="en" | ||
head | ||
meta charset="UTF-8" | ||
title -- Marko Components Tests | ||
lasso-head | ||
body | ||
|
||
div id="test" | ||
div id="mocha" | ||
div id="testsTarget" | ||
|
||
split-component | ||
|
||
lasso-body | ||
|
||
init-components immediate | ||
|
||
lasso-slot name="mocha-run" | ||
|
||
browser-refresh |
27 changes: 27 additions & 0 deletions
27
test/autotests/components-pages/split-emit-multi-args/tests.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var path = require('path'); | ||
var expect = require('chai').expect; | ||
|
||
function triggerMouseEvent(el, type) { | ||
var ev = document.createEvent("MouseEvent"); | ||
ev.initMouseEvent( | ||
type, | ||
true /* bubble */, true /* cancelable */, | ||
window, null, | ||
0, 0, 0, 0, /* coordinates */ | ||
false, false, false, false, /* modifier keys */ | ||
0 /*left*/, null | ||
); | ||
el.dispatchEvent(ev); | ||
} | ||
|
||
function triggerClick(el) { | ||
triggerMouseEvent(el, 'click'); | ||
} | ||
|
||
describe(path.basename(__dirname), function() { | ||
it('should allow getEl() with a split component', function() { | ||
var app = window.splitComponent; | ||
triggerClick(app.el); | ||
expect(app.clicked).to.equal(true); | ||
}); | ||
}); |