aboutsummaryrefslogtreecommitdiff
path: root/catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html
diff options
context:
space:
mode:
Diffstat (limited to 'catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html')
-rw-r--r--catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html b/catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html
new file mode 100644
index 00000000..b342cfd1
--- /dev/null
+++ b/catapult/third_party/polymer/components/iron-behaviors/test/disabled-state.html
@@ -0,0 +1,82 @@
+<!doctype html>
+<!--
+@license
+Copyright (c) 2015 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
+-->
+<html>
+<head>
+ <title>disabled-state</title>
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+ <link rel="import" href="test-elements.html">
+</head>
+<body>
+
+ <test-fixture id="TrivialDisabledState">
+ <template>
+ <test-control></test-control>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="InitiallyDisabledState">
+ <template>
+ <test-control disabled></test-control>
+ </template>
+ </test-fixture>
+
+ <script>
+ suite('disabled-state', function() {
+ var disableTarget;
+
+ suite('a trivial disabled state', function() {
+ setup(function() {
+ disableTarget = fixture('TrivialDisabledState');
+ });
+
+ suite('when disabled is true', function() {
+ test('receives a disabled attribute', function() {
+ disableTarget.disabled = true;
+ expect(disableTarget.hasAttribute('disabled')).to.be.eql(true);
+ });
+
+ test('receives an appropriate aria attribute', function() {
+ disableTarget.disabled = true;
+ expect(disableTarget.getAttribute('aria-disabled')).to.be.eql('true');
+ });
+ });
+
+ suite('when disabled is false', function() {
+ test('loses the disabled attribute', function() {
+ disableTarget.disabled = true;
+ expect(disableTarget.hasAttribute('disabled')).to.be.eql(true);
+ disableTarget.disabled = false;
+ expect(disableTarget.hasAttribute('disabled')).to.be.eql(false);
+ });
+ });
+ });
+
+ suite('a state with an initially disabled target', function() {
+ setup(function() {
+ disableTarget = fixture('InitiallyDisabledState');
+ });
+
+ test('preserves the disabled attribute on target', function() {
+ expect(disableTarget.hasAttribute('disabled')).to.be.eql(true);
+ expect(disableTarget.disabled).to.be.eql(true);
+ });
+
+ test('adds `aria-disabled` to the target', function() {
+ expect(disableTarget.getAttribute('aria-disabled')).to.be.eql('true');
+ });
+ });
+ });
+ </script>
+
+</body>
+</html>