mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 15:53:12 +00:00
Merge pull request #67 from keanulee/master
CustomEvent detail test for CustomElements and HTMLImports
This commit is contained in:
34
tests/CustomElements/html/customevent-detail.html
Normal file
34
tests/CustomElements/html/customevent-detail.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CustomEvent detail test</title>
|
||||
<script src="../../tools/htmltest.js"></script>
|
||||
<script src="../../tools/chai/chai.js"></script>
|
||||
<script src="../../../src/CustomElements/CustomElements.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
addEventListener('WebComponentsReady', function() {
|
||||
var eventName = 'some-event';
|
||||
var eventDetail = 'some-detail';
|
||||
|
||||
document.body.addEventListener(eventName, function(evt) {
|
||||
chai.assert.equal(evt.detail, eventDetail, 'expected CustomEvent detail');
|
||||
done();
|
||||
});
|
||||
|
||||
var evt = new CustomEvent(eventName, {detail: eventDetail});
|
||||
document.body.dispatchEvent(evt);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -509,6 +509,7 @@ suite('customElements', function() {
|
||||
|
||||
htmlSuite('customElements (html)', function() {
|
||||
htmlTest('../html/attributes.html');
|
||||
htmlTest('../html/customevent-detail.html');
|
||||
htmlTest('../html/upgrade-order.html');
|
||||
htmlTest('../html/upgrade-dcl.html');
|
||||
htmlTest('../html/imports.html');
|
||||
|
||||
34
tests/HTMLImports/html/customevent-detail.html
Normal file
34
tests/HTMLImports/html/customevent-detail.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CustomEvent detail test</title>
|
||||
<script src="../../tools/htmltest.js"></script>
|
||||
<script src="../../tools/chai/chai.js"></script>
|
||||
<script src="../../../src/HTMLImports/HTMLImports.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
addEventListener('HTMLImportsLoaded', function() {
|
||||
var eventName = 'some-event';
|
||||
var eventDetail = 'some-detail';
|
||||
|
||||
document.body.addEventListener(eventName, function(evt) {
|
||||
chai.assert.equal(evt.detail, eventDetail, 'expected CustomEvent detail');
|
||||
done();
|
||||
});
|
||||
|
||||
var evt = new CustomEvent(eventName, {detail: eventDetail});
|
||||
document.body.dispatchEvent(evt);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,6 +18,7 @@ htmlSuite('HTMLImports', function() {
|
||||
htmlTest('html/dedupe.html');
|
||||
htmlTest('html/dynamic.html');
|
||||
htmlTest('html/csp.html');
|
||||
htmlTest('html/customevent-detail.html');
|
||||
htmlTest('html/encoding.html');
|
||||
htmlTest('html/HTMLImportsLoaded-native.html');
|
||||
// NOTE: The MO polyfill does not function on disconnected documents
|
||||
|
||||
Reference in New Issue
Block a user