Merge pull request #67 from keanulee/master

CustomEvent detail test for CustomElements and HTMLImports
This commit is contained in:
Steve Orvell
2014-11-20 14:56:03 -08:00
4 changed files with 70 additions and 0 deletions

View 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>

View File

@@ -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');

View 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>

View File

@@ -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