Skip to content

Commit

Permalink
Add formatconfig.json; format.
Browse files Browse the repository at this point in the history
  • Loading branch information
bicknellr committed Jul 26, 2018
1 parent 36a73a9 commit 19e88d8
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 68 deletions.
8 changes: 4 additions & 4 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</head>
<body unresolved>
<script type="module">
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
const template = html`<custom-style>
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
const template = html`<custom-style>
<style is="custom-style" include="demo-pages-shared-styles">
.vertical-section-container {
max-width: 500px;
Expand Down Expand Up @@ -88,7 +88,7 @@ <h3>Toggle buttons can be styled using custom properties</h3>
</demo-snippet>
</div>`;

document.body.appendChild(template.content);
</script>
document.body.appendChild(template.content);
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions formatconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"style": {
"ReflowComments": false
}
}
13 changes: 7 additions & 6 deletions paper-toggle-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ 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
*/
import '@polymer/polymer/polymer-legacy.js';

import '@polymer/iron-flex-layout/iron-flex-layout.js';
import '@polymer/paper-styles/color.js';
import '@polymer/paper-styles/default-theme.js';
import { PaperCheckedElementBehavior } from '@polymer/paper-behaviors/paper-checked-element-behavior.js';
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';

import {PaperCheckedElementBehavior} from '@polymer/paper-behaviors/paper-checked-element-behavior.js';
import {PaperRippleBehavior} from '@polymer/paper-behaviors/paper-ripple-behavior.js';
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
import {setTouchAction} from '@polymer/polymer/lib/utils/gestures.js';
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
import { setTouchAction } from '@polymer/polymer/lib/utils/gestures.js';
import { PaperRippleBehavior } from '@polymer/paper-behaviors/paper-ripple-behavior.js';
import {afterNextRender} from '@polymer/polymer/lib/utils/render-status.js';

const template = html`
<style>
Expand Down
112 changes: 56 additions & 56 deletions test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,71 +27,71 @@
</test-fixture>

<script type="module">
import '@polymer/iron-test-helpers/mock-interactions.js';
import '@polymer/test-fixture/test-fixture.js';
import '../paper-toggle-button.js';
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
import { a11ySuite } from 'wct-browser-legacy/a11ySuite.js';
suite('defaults', function() {
var b1;
import '@polymer/iron-test-helpers/mock-interactions.js';
import '@polymer/test-fixture/test-fixture.js';
import '../paper-toggle-button.js';
import {afterNextRender} from '@polymer/polymer/lib/utils/render-status.js';
import {a11ySuite} from 'wct-browser-legacy/a11ySuite.js';
suite('defaults', function() {
var b1;

setup(function() {
b1 = fixture('Basic');
});
setup(function() {
b1 = fixture('Basic');
});

test('set scroll direction', function(done) {
afterNextRender(b1, function() {
assert.equal(b1.__polymerGesturesTouchAction, 'pan-y');
done();
});
});
test('set scroll direction', function(done) {
afterNextRender(b1, function() {
assert.equal(b1.__polymerGesturesTouchAction, 'pan-y');
done();
});
});

test('check button via click', function(done) {
b1.addEventListener('click', function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
});
MockInteractions.tap(b1);
});
test('check button via click', function(done) {
b1.addEventListener('click', function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
});
MockInteractions.tap(b1);
});

test('toggle button via click', function(done) {
b1.checked = true;
b1.addEventListener('click', function() {
assert.isFalse(b1.getAttribute('aria-pressed') == 'true');
assert.isFalse(b1.checked);
done();
});
MockInteractions.tap(b1);
});
test('toggle button via click', function(done) {
b1.checked = true;
b1.addEventListener('click', function() {
assert.isFalse(b1.getAttribute('aria-pressed') == 'true');
assert.isFalse(b1.checked);
done();
});
MockInteractions.tap(b1);
});

test('disabled button cannot be clicked', function(done) {
b1.disabled = true;
b1.checked = true;
MockInteractions.tap(b1);
test('disabled button cannot be clicked', function(done) {
b1.disabled = true;
b1.checked = true;
MockInteractions.tap(b1);

setTimeout(function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
}, 1);
});
});
setTimeout(function() {
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
assert.isTrue(b1.checked);
done();
}, 1);
});
});

suite('a11y', function() {
var b1;
suite('a11y', function() {
var b1;

setup(function() {
b1 = fixture('Basic');
});
setup(function() {
b1 = fixture('Basic');
});

test('has aria role "button"', function() {
console.log(b1.getAttribute('role'));
assert.isTrue(b1.getAttribute('role') == 'button');
});
test('has aria role "button"', function() {
console.log(b1.getAttribute('role'));
assert.isTrue(b1.getAttribute('role') == 'button');
});

a11ySuite('Basic');
});
</script>
a11ySuite('Basic');
});
</script>
</body>
</html>
3 changes: 1 addition & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
</head>
<body>
<script>
WCT.loadSuites(
['basic.html', 'basic.html?wc-shadydom=true&wc-ce=true']);
WCT.loadSuites(['basic.html', 'basic.html?wc-shadydom=true&wc-ce=true']);
</script>


Expand Down

0 comments on commit 19e88d8

Please sign in to comment.