mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
600fceeb54
commit
9956595625
25 changed files with 213 additions and 284 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-menu-behavior",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"description": "Provides accessible menu behavior",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
@ -34,11 +34,11 @@
|
|||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.1.5",
|
||||
"_release": "1.1.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.5",
|
||||
"commit": "e17b3bdb124e42202d50e7c60b0cf02d9bcb201d"
|
||||
"tag": "v1.1.6",
|
||||
"commit": "940c2769c7d6fefd5685e0200c3dfd0742c2a52f"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
language: node_js
|
||||
sudo: false
|
||||
sudo: required
|
||||
before_script:
|
||||
- npm install -g bower polylint web-component-tester
|
||||
- bower install
|
||||
|
@ -8,18 +8,16 @@ env:
|
|||
global:
|
||||
- secure: QxZD8yzz7s3F6b7h87ztWYiEbD2TrQp1Z1mib5u1wL7EAwsrQVkFhIEo4cJPAsTGS98qgeZAITg0ifwp/jOKVC2QKoPnC1qjm4L0AjlhXBTRbqyS5G8jvfJ8M4DgkQXADh4e+lw9ba3h2AxceJELKTYaQVq/cpTrpPg0/RH7H4o=
|
||||
- secure: i76J23Bpwj6qJ4ybCCsQpGCTT+5s1PA+x0Avjbl1JTS4OsJLDFfvVl0YIWZ5xMIKJtdPC/mGDoZ2LNrh9hz82DBqDnzBlSnNjFbjnU1Aqy5CUmRWzyAF5NOjJGotISZcDYDGZd6gjsOfN0r+rICyRUiOadeyPf0Nm+6HSVQMjfM=
|
||||
- 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"
|
||||
dist: trusty
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-menu-behavior",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.6",
|
||||
"description": "Provides accessible menu behavior",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
|
|
@ -128,7 +128,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var attr = this.attrForItemTitle || 'textContent';
|
||||
var title = item[attr] || item.getAttribute(attr);
|
||||
|
||||
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
||||
if (!item.hasAttribute('disabled') && title &&
|
||||
title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
||||
this._setFocusedItem(item);
|
||||
break;
|
||||
}
|
||||
|
@ -137,21 +138,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
/**
|
||||
* Focuses the previous item (relative to the currently focused item) in the
|
||||
* menu.
|
||||
* menu, disabled items will be skipped.
|
||||
*/
|
||||
_focusPrevious: function() {
|
||||
var length = this.items.length;
|
||||
var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
|
||||
this._setFocusedItem(this.items[index]);
|
||||
var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
||||
for (var i = 1; i < length; i++) {
|
||||
var item = this.items[(curFocusIndex - i + length) % length];
|
||||
if (!item.hasAttribute('disabled')) {
|
||||
this._setFocusedItem(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Focuses the next item (relative to the currently focused item) in the
|
||||
* menu.
|
||||
* menu, disabled items will be skipped.
|
||||
*/
|
||||
_focusNext: function() {
|
||||
var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
|
||||
this._setFocusedItem(this.items[index]);
|
||||
var length = this.items.length;
|
||||
var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
||||
for (var i = 1; i < length; i++) {
|
||||
var item = this.items[(curFocusIndex + i) % length];
|
||||
if (!item.hasAttribute('disabled')) {
|
||||
this._setFocusedItem(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -260,7 +274,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
if (selectedItem) {
|
||||
this._setFocusedItem(selectedItem);
|
||||
} else if (this.items[0]) {
|
||||
this._setFocusedItem(this.items[0]);
|
||||
// We find the first none-disabled item (if one exists)
|
||||
this._focusNext();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -36,6 +36,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="disabled">
|
||||
<template>
|
||||
<test-menu>
|
||||
<div>a item 1</div>
|
||||
<div disabled>b item 2</div>
|
||||
<div>b item 3</div>
|
||||
<div disabled>c item 4</div>
|
||||
</test-menu>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="only-disabled">
|
||||
<template>
|
||||
<test-menu>
|
||||
<div disabled>disabled item</div>
|
||||
</test-menu>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="multi">
|
||||
<template>
|
||||
<test-menu multi>
|
||||
|
@ -94,6 +113,156 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
});
|
||||
|
||||
test('focusing on next item skips disabled items', function(done) {
|
||||
var menu = fixture('disabled');
|
||||
MockInteractions.focus(menu);
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press down
|
||||
MockInteractions.keyDownOn(menu, 40);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on next item in empty menu', function(done) {
|
||||
var menu = fixture('empty');
|
||||
MockInteractions.focus(menu);
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press down
|
||||
MockInteractions.keyDownOn(menu, 40);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, undefined, 'no focused item');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on next item in all disabled menu', function(done) {
|
||||
var menu = fixture('only-disabled');
|
||||
MockInteractions.focus(menu);
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press down
|
||||
MockInteractions.keyDownOn(menu, 40);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, undefined, 'no focused item');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on previous item skips disabled items', function(done) {
|
||||
var menu = fixture('disabled');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press up
|
||||
MockInteractions.keyDownOn(menu, 38);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on previous item in empty menu', function(done) {
|
||||
var menu = fixture('empty');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press up
|
||||
MockInteractions.keyDownOn(menu, 38);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, undefined, 'no focused item');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on previous item in all disabled menu', function(done) {
|
||||
var menu = fixture('only-disabled');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press up
|
||||
MockInteractions.keyDownOn(menu, 38);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, undefined, 'no focused item');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on item using key press skips disabled items', function(done) {
|
||||
var menu = fixture('disabled');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press 'b'
|
||||
MockInteractions.keyDownOn(menu, 66);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on item using key press ignores disabled items', function(done) {
|
||||
var menu = fixture('disabled');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press 'c'
|
||||
MockInteractions.keyDownOn(menu, 67);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, menu.items[0], 'menu.items[0] is focused');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing on item using key press in all disabled items', function(done) {
|
||||
var menu = fixture('only-disabled');
|
||||
MockInteractions.focus(menu);
|
||||
|
||||
// Wait for async focus
|
||||
Polymer.Base.async(function() {
|
||||
// Key press 'c'
|
||||
MockInteractions.keyDownOn(menu, 67);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||
assert.equal(focusedItem, undefined, 'no focused item');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('focusing non-item content does not auto-focus an item', function(done) {
|
||||
var menu = fixture('basic');
|
||||
menu.extraContent.focus();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue