mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/*
|
|
* Copyright 2012 The Toolkitchen 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('g-togglebutton', function() {
|
|
var togglebutton;
|
|
|
|
setup(function() {
|
|
togglebutton = document.createElement('g-togglebutton');
|
|
work.appendChild(togglebutton);
|
|
});
|
|
|
|
teardown(function() {
|
|
work.textContent = '';
|
|
});
|
|
|
|
test('initial value', function() {
|
|
expect(togglebutton.value).to.not.be.ok();
|
|
});
|
|
|
|
test('toggle', function() {
|
|
var t = ShadowDOM.localQuery(togglebutton.shadow, '.toggle');
|
|
togglebutton.toggle();
|
|
expect(t.classList.contains('on')).to.be(true);
|
|
togglebutton.toggle();
|
|
expect(t.classList.contains('on')).to.be(false);
|
|
});
|
|
|
|
suite('attributes', function() {
|
|
test('value', function() {
|
|
var t = ShadowDOM.localQuery(togglebutton.shadow, '.toggle');
|
|
togglebutton.value = true;
|
|
expect(t.classList.contains('on')).to.be(true);
|
|
togglebutton.value = false;
|
|
expect(t.classList.contains('on')).to.be(false);
|
|
});
|
|
});
|
|
});
|