update components

This commit is contained in:
Luke Pulverenti 2016-02-02 15:36:33 -05:00
parent 8d9ac6ef88
commit 2a4b879c21
9 changed files with 92 additions and 27 deletions

View File

@ -1,6 +1,6 @@
{
"name": "iron-menu-behavior",
"version": "1.0.7",
"version": "1.1.0",
"description": "Provides accessible menu behavior",
"authors": "The Polymer Authors",
"keywords": [
@ -23,7 +23,7 @@
"ignore": [],
"dependencies": {
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0",
"polymer": "Polymer/polymer#^1.2.4",
"iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.0.0"
},
"devDependencies": {
@ -31,14 +31,14 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.7",
"_release": "1.1.0",
"_resolution": {
"type": "version",
"tag": "v1.0.7",
"commit": "e5ca054bbe1c24fbc43adb78217ccc50d9223601"
"tag": "v1.1.0",
"commit": "b18d5478f1d4d6befb15533716d60d5772f8e812"
},
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
"_target": "^1.0.0",

View File

@ -1,22 +1,25 @@
language: node_js
sudo: false
before_script:
- npm install web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- npm install -g bower polylint web-component-tester
- bower install
- polylint
env:
global:
- secure: QxZD8yzz7s3F6b7h87ztWYiEbD2TrQp1Z1mib5u1wL7EAwsrQVkFhIEo4cJPAsTGS98qgeZAITg0ifwp/jOKVC2QKoPnC1qjm4L0AjlhXBTRbqyS5G8jvfJ8M4DgkQXADh4e+lw9ba3h2AxceJELKTYaQVq/cpTrpPg0/RH7H4o=
- secure: i76J23Bpwj6qJ4ybCCsQpGCTT+5s1PA+x0Avjbl1JTS4OsJLDFfvVl0YIWZ5xMIKJtdPC/mGDoZ2LNrh9hz82DBqDnzBlSnNjFbjnU1Aqy5CUmRWzyAF5NOjJGotISZcDYDGZd6gjsOfN0r+rICyRUiOadeyPf0Nm+6HSVQMjfM=
node_js: 4
- CXX=g++-4.8
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View File

@ -1,6 +1,6 @@
{
"name": "iron-menu-behavior",
"version": "1.0.7",
"version": "1.1.0",
"description": "Provides accessible menu behavior",
"authors": "The Polymer Authors",
"keywords": [
@ -23,7 +23,7 @@
"ignore": [],
"dependencies": {
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
"polymer": "Polymer/polymer#^1.0.0",
"polymer": "Polymer/polymer#^1.2.4",
"iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.0.0"
},
"devDependencies": {
@ -31,7 +31,7 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
}

View File

@ -74,7 +74,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Selects the given value. If the `multi` property is true, then the selected state of the
* `value` will be toggled; otherwise the `value` will be selected.
*
* @param {string} value the value to select.
* @param {string|number} value the value to select.
*/
select: function(value) {
if (this._defaultFocusAsync) {

View File

@ -39,12 +39,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
event.detail.keyboardEvent.preventDefault();
},
get _isRTL() {
return window.getComputedStyle(this)['direction'] === 'rtl';
},
_onLeftKey: function() {
if (this._isRTL) {
this._focusNext();
} else {
this._focusPrevious();
}
},
_onRightKey: function() {
if (this._isRTL) {
this._focusPrevious();
} else {
this._focusNext();
}
},
_onKeydown: function(event) {

View File

@ -70,7 +70,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('first item gets focus when menu is focused', function(done) {
var menu = fixture('basic');
menu.focus();
MockInteractions.focus(menu);
setTimeout(function() {
assert.equal(document.activeElement, menu.firstElementChild, 'document.activeElement is first item')
done();
@ -81,7 +81,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('selected item gets focus when menu is focused', function(done) {
var menu = fixture('basic');
menu.selected = 1;
menu.focus();
MockInteractions.focus(menu);
setTimeout(function() {
assert.equal(document.activeElement, menu.selectedItem, 'document.activeElement is selected item');
done();

View File

@ -19,6 +19,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
<link rel="import" href="test-menubar.html">
</head>
@ -44,6 +45,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="rtl">
<template>
<div dir="rtl">
<test-menubar>
<div>item 1</div>
<div>item 2</div>
<div>item 3</div>
</test-menubar>
</div>
</template>
</test-fixture>
<script>
suite('menubar a11y tests', function() {
@ -55,9 +68,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('first item gets focus when menubar is focused', function(done) {
var menubar = fixture('basic');
menubar.focus();
MockInteractions.focus(menubar);
setTimeout(function() {
assert.equal(document.activeElement, menubar.firstElementChild, 'document.activeElement is first item')
assert.equal(Polymer.dom(document).activeElement, menubar.firstElementChild, 'document.activeElement is first item')
done();
// wait for async in _onFocus
}, 200);
@ -66,9 +79,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('selected item gets focus when menubar is focused', function(done) {
var menubar = fixture('basic');
menubar.selected = 1;
menubar.focus();
MockInteractions.focus(menubar);
setTimeout(function() {
assert.equal(document.activeElement, menubar.selectedItem, 'document.activeElement is selected item');
assert.equal(Polymer.dom(document).activeElement, menubar.selectedItem, 'document.activeElement is selected item');
done();
// wait for async in _onFocus
}, 200);
@ -79,7 +92,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
menubar.selected = 0;
menubar.items[1].click();
setTimeout(function() {
assert.equal(document.activeElement, menubar.items[1], 'document.activeElement is last activated item');
assert.equal(Polymer.dom(document).activeElement, menubar.items[1], 'document.activeElement is last activated item');
done();
// wait for async in _onFocus
}, 200);
@ -90,12 +103,49 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
menubar.selected = 0;
menubar.items[0].click();
setTimeout(function() {
assert.equal(document.activeElement, menubar.items[0], 'document.activeElement is last activated item');
assert.equal(Polymer.dom(document).activeElement, menubar.items[0], 'document.activeElement is last activated item');
done();
// wait for async in _onFocus
}, 200);
});
suite('left / right keys are reversed when the menubar has RTL directionality', function() {
var LEFT = 37;
var RIGHT = 39;
test('left key moves to the next item', function() {
var rtlContainer = fixture('rtl');
var menubar = rtlContainer.querySelector('test-menubar');
menubar.selected = 0;
menubar.items[1].click();
assert.equal(Polymer.dom(document).activeElement, menubar.items[1]);
MockInteractions.pressAndReleaseKeyOn(menubar, LEFT);
assert.equal(Polymer.dom(document).activeElement, menubar.items[2],
'`document.activeElement` should be the next item.');
assert.equal(menubar.selected, 1,
'`menubar.selected` should not change.');
});
test('right key moves to the previous item', function() {
var rtlContainer = fixture('rtl');
var menubar = rtlContainer.querySelector('test-menubar');
menubar.selected = 0;
menubar.items[1].click();
assert.equal(Polymer.dom(document).activeElement, menubar.items[1]);
MockInteractions.pressAndReleaseKeyOn(menubar, RIGHT);
assert.equal(Polymer.dom(document).activeElement, menubar.items[0],
'`document.activeElement` should be the previous item');
assert.equal(menubar.selected, 1,
'`menubar.selected` should not change.');
});
});
});
</script>

View File

@ -36,7 +36,7 @@
"tag": "v1.2.0",
"commit": "17a94bd1555d3321f4ecefd472f0c470d48e9e94"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_source": "git://github.com/polymerelements/iron-selector.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-selector"
"_originalSource": "polymerelements/iron-selector"
}

View File

@ -34,6 +34,6 @@
"commit": "284332a905ddd60eab11901a82ac037976175cf8"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.2.0",
"_target": "^1.0.0",
"_originalSource": "Polymer/polymer"
}