mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
/*
|
|
* Copyright 2013 The Polymer-Project Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style
|
|
* license that can be found in the LICENSE file.
|
|
*/
|
|
|
|
suite('register', function() {
|
|
var assert = chai.assert;
|
|
|
|
var work;
|
|
|
|
setup(function() {
|
|
work = document.createElement('div');
|
|
wrap(document.body).appendChild(work);
|
|
});
|
|
|
|
teardown(function() {
|
|
wrap(document.body).removeChild(work);
|
|
});
|
|
|
|
test('register', function() {
|
|
work.innerHTML = '<element name="x-foo">' +
|
|
'<script>' +
|
|
'Polymer.register(this, {' +
|
|
'ready: function() {' +
|
|
'this.message = "foo";' +
|
|
'},' +
|
|
'sayHello: function() {' +
|
|
'this.message = "hello";' +
|
|
'}' +
|
|
'});' +
|
|
'</script>' +
|
|
'</element>';
|
|
var test = new HTMLElementElement(work.querySelector('element'));
|
|
var foo = document.createElement('x-foo');
|
|
// test ready
|
|
assert.equal(foo.message, 'foo');
|
|
// test sayHello
|
|
foo.sayHello();
|
|
assert.equal(foo.message, 'hello');
|
|
});
|
|
}); |