merge from dev

This commit is contained in:
Luke Pulverenti 2015-12-14 10:43:03 -05:00
parent 1c8f02ce0f
commit 33b01d778c
911 changed files with 34157 additions and 57125 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-menu-behavior",
"version": "1.0.5",
"version": "1.0.7",
"description": "Provides accessible menu behavior",
"authors": "The Polymer Authors",
"keywords": [
@ -29,15 +29,16 @@
"devDependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.2",
"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": "*",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.5",
"_release": "1.0.7",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "f06af97a224fcb2098f4a0229ec2500350d4ccf0"
"tag": "v1.0.7",
"commit": "e5ca054bbe1c24fbc43adb78217ccc50d9223601"
},
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
"_target": "^1.0.0",

View file

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

View file

@ -0,0 +1,72 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
-->
# Polymer Elements
## Guide for Contributors
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
### Filing Issues
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
1. **Who will use the feature?** _“As someone filling out a form…”_
2. **When will they use the feature?** _“When I enter an invalid value…”_
3. **What is the users goal?** _“I want to be visually notified that the value needs to be corrected…”_
**If you are filing an issue to report a bug**, please provide:
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
```markdown
The `paper-foo` element causes the page to turn pink when clicked.
## Expected outcome
The page stays the same color.
## Actual outcome
The page turns pink.
## Steps to reproduce
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
### Submitting Pull Requests
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, #40
```
2. **A succinct description of the design** used to fix any related issues. For example:
```markdown
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
```
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so dont be afraid to ask us if you need help with that!

View file

@ -1,6 +1,6 @@
{
"name": "iron-menu-behavior",
"version": "1.0.5",
"version": "1.0.7",
"description": "Provides accessible menu behavior",
"authors": "The Polymer Authors",
"keywords": [
@ -29,8 +29,9 @@
"devDependencies": {
"paper-styles": "polymerelements/paper-styles#^1.0.2",
"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": "*",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
}

View file

@ -18,9 +18,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<title>iron-menu-behavior demo</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../paper-styles/paper-styles.html">
<link rel="import" href="../../paper-styles/color.html">
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../../paper-styles/default-theme.html">
<link rel="import" href="simple-menu.html">
<link rel="import" href="simple-menubar.html">
@ -59,7 +59,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</head>
<body unresolved>
<div class="horizontal center-justified layout">
<div class="horizontal-section-container">
<div>
<h3>Simple menu</h3>
<div class="horizontal-section">

View file

@ -10,6 +10,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-menu-behavior.html">
<link rel="import" href="../../paper-styles/color.html">
<dom-module id="simple-menu">

View file

@ -10,6 +10,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-menubar-behavior.html">
<link rel="import" href="../../paper-styles/color.html">
<dom-module id="simple-menubar">

View file

@ -125,6 +125,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
for (var i = 0, item; item = this.items[i]; i++) {
var attr = this.attrForItemTitle || 'textContent';
var title = item[attr] || item.getAttribute(attr);
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
this._setFocusedItem(item);
break;
@ -165,7 +166,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} else {
item.removeAttribute('aria-selected');
}
Polymer.IronSelectableBehavior._applySelection.apply(this, arguments);
},
@ -213,18 +213,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {CustomEvent} event A key combination event.
*/
_onShiftTabDown: function(event) {
var oldTabIndex;
var oldTabIndex = this.getAttribute('tabindex');
Polymer.IronMenuBehaviorImpl._shiftTabPressed = true;
oldTabIndex = this.getAttribute('tabindex');
this._setFocusedItem(null);
this.setAttribute('tabindex', '-1');
this.async(function() {
this.setAttribute('tabindex', oldTabIndex);
Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
// NOTE(cdata): polymer/polymer#1305
// NOTE(cdata): polymer/polymer#1305
}, 1);
},
@ -235,23 +235,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
_onFocus: function(event) {
if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) {
// do not focus the menu itself
return;
}
// do not focus the menu itself
this.blur();
// clear the cached focus item
this._setFocusedItem(null);
this._defaultFocusAsync = this.async(function() {
// focus the selected item when the menu receives focus, or the first item
// if no item is selected
var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;
this._setFocusedItem(null);
if (selectedItem) {
this._setFocusedItem(selectedItem);
} else {
this._setFocusedItem(this.items[0]);
}
// async 100ms to wait for `select` to get called from `_itemActivate`
}, 100);
// async 1ms to wait for `select` to get called from `_itemActivate`
}, 1);
},
/**
@ -289,12 +293,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {KeyboardEvent} event A keyboard event.
*/
_onKeydown: function(event) {
if (this.keyboardEventMatchesKeys(event, 'up down esc')) {
return;
if (!this.keyboardEventMatchesKeys(event, 'up down esc')) {
// all other keys focus the menu item starting with that character
this._focusWithKeyboardEvent(event);
}
event.stopPropagation();
},
// all other keys focus the menu item starting with that character
this._focusWithKeyboardEvent(event);
// override _activateHandler
_activateHandler: function(event) {
Polymer.IronSelectableBehavior._activateHandler.call(this, event);
event.stopPropagation();
}
};

View file

@ -1,5 +1,4 @@
<!doctype html>
<!--
<!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
@ -7,9 +6,7 @@ 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>
--><html><head>
<title>iron-menu-behavior tests</title>
@ -23,13 +20,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script>
WCT.loadSuites([
'iron-menu-behavior.html',
'iron-menubar-behavior.html'
'iron-menubar-behavior.html',
'iron-menu-behavior.html?dom=shadow',
'iron-menubar-behavior.html?dom=shadow'
]);
</script>
</body>
</html>
</body></html>

View file

@ -17,12 +17,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="test-menu.html">
</head>
@ -48,6 +46,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="nested">
<template>
<test-menu>
<test-menu>
<div>item 1</div>
<div>item 2</div>
<div>item 3</div>
</test-menu>
</test-menu>
</template>
</test-fixture>
<script>
suite('menu a11y tests', function() {
@ -100,6 +111,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, 200);
});
test('keyboard events should not bubble', function(done) {
var menu = fixture('nested');
var keyCounter = 0;
menu.addEventListener('keydown', function(event) {
if (menu.keyboardEventMatchesKeys(event, 'esc')) {
keyCounter++;
}
if (menu.keyboardEventMatchesKeys(event, 'up')) {
keyCounter++;
}
if (menu.keyboardEventMatchesKeys(event, 'down')) {
keyCounter++;
}
});
// up
MockInteractions.keyDownOn(menu.firstElementChild, 38);
// down
MockInteractions.keyDownOn(menu.firstElementChild, 40);
// esc
MockInteractions.keyDownOn(menu.firstElementChild, 27);
setTimeout(function() {
assert.equal(menu.firstElementChild.tagName, 'TEST-MENU');
assert.equal(keyCounter, 0);
done();
}, 200);
});
});
</script>

View file

@ -18,11 +18,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="test-menubar.html">
</head>