update components

This commit is contained in:
Luke Pulverenti 2016-05-28 13:34:07 -04:00
parent abf163fb4a
commit b385aa2d95
22 changed files with 368 additions and 90 deletions

View File

@ -1,6 +1,6 @@
{
"name": "iron-location",
"version": "0.8.2",
"version": "0.8.3",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
@ -37,11 +37,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
},
"_release": "0.8.2",
"_release": "0.8.3",
"_resolution": {
"type": "version",
"tag": "v0.8.2",
"commit": "9ab0b3bf4b30e00d1f80dcb1cf9e00bd17cce4a5"
"tag": "v0.8.3",
"commit": "cb124aa740c07d2b65af1d7e05a3cf8fd6a25f87"
},
"_source": "git://github.com/PolymerElements/iron-location.git",
"_target": "^0.8.0",

View File

@ -11,7 +11,7 @@
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
<!-- Example: https://jsbin.com/lebawa/edit?html,output -->
### Steps to reproduce

View File

@ -1,4 +1,3 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
@ -11,6 +10,7 @@ specific element:
jsbin=https://jsbin.com/lebawa/edit?html,output
-->
# Polymer Elements
## Guide for Contributors
@ -46,7 +46,7 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
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: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
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: [https://jsbin.com/lebawa/edit?html,output](https://jsbin.com/lebawa/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.

View File

@ -1,6 +1,6 @@
{
"name": "iron-location",
"version": "0.8.2",
"version": "0.8.3",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [

View File

@ -243,10 +243,6 @@ milliseconds.
* is clicking on, if we can and should override the resulting full
* page navigation. Returns null otherwise.
*
* This method is separated away from _globalOnClick for testability,
* as we can't test that a clicked link should have resulted in navigating
* away from the test page.
*
* @param {MouseEvent} event .
* @return {string?} .
*/
@ -261,19 +257,33 @@ milliseconds.
return null;
}
var eventPath = Polymer.dom(event).path;
var href = null;
var anchor = null;
for (var i = 0; i < eventPath.length; i++) {
var element = eventPath[i];
if (element.tagName === 'A' && element.href) {
href = element.href;
anchor = element;
break;
}
}
// If there's no link there's nothing to do.
if (!href) {
return null;
if (!anchor) {
return;
}
// Target blank is a new tab, don't intercept.
if (anchor.target === '_blank') {
return;
}
// If the link is for an existing parent frame, don't intercept.
if ((anchor.target === '_top' ||
anchor.target === '_parent') &&
window.top !== window) {
return;
}
var href = anchor.href;
// It only makes sense for us to intercept same-origin navigations.
// pushState/replaceState don't work with cross-origin links.
var url;

View File

@ -61,10 +61,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
}
function makeAbsoluteUrl(path) {
return window.location.protocol + '//' + window.location.host + path;
}
// A window.history.replaceState wrapper that's smart about baseURI.
function replaceState(url) {
window.history.replaceState(
{}, '', window.location.protocol + '//' + window.location.host + url);
function replaceState(path) {
window.history.replaceState({}, '', makeAbsoluteUrl(path));
}
/**
@ -164,6 +167,77 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assertHaveSameUrls(urlElem, otherUrlElem);
});
});
suite('when intercepting links', function() {
/**
* Clicks the given link while an iron-location element with the given
* urlSpaceRegex is in the same document. Returns whether the
* iron-location prevented the default behavior of the click.
*
* No matter what, it prevents the default behavior of the click itself
* to ensure that no navigation occurs (as that would interrupt
* running and reporting these tests!)
*/
function isClickCaptured(anchor, urlSpaceRegex) {
var defaultWasPrevented;
function handler(event) {
expect(event.target).to.be.eq(anchor);
defaultWasPrevented = event.defaultPrevented;
event.preventDefault();
expect(event.defaultPrevented).to.be.eq(true);
}
window.addEventListener('click', handler);
var ironLocation = fixture('Solo');
if (urlSpaceRegex != null) {
ironLocation.urlSpaceRegex = urlSpaceRegex;
}
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
window.removeEventListener('click', handler);
return defaultWasPrevented;
}
test('simple link to / is intercepted', function() {
var anchor = document.createElement('a');
if (document.baseURI !== window.location.href) {
anchor.href = makeAbsoluteUrl('/');
} else {
anchor.href = '/';
}
expect(isClickCaptured(anchor)).to.be.eq(true);
});
test('link that matches url space is intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/foo');
expect(isClickCaptured(anchor, '/fo+')).to.be.eq(true);
});
test('link that doesn\'t match url space isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/bar');
expect(isClickCaptured(anchor, '/fo+')).to.be.eq(false);
});
test('link to another domain isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = 'http://example.com/';
expect(isClickCaptured(anchor)).to.be.eq(false);
});
test('a link with target=_blank isn\'t intercepted', function() {
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/');
anchor.target = '_blank';
expect(isClickCaptured(anchor)).to.be.eq(false);
})
});
suite('supports doing synchronous redirection', function() {
test('of the hash portion of the URL', function() {

View File

@ -1,6 +1,6 @@
{
"name": "iron-range-behavior",
"version": "1.0.4",
"version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors",
@ -9,9 +9,7 @@
"polymer",
"behavior"
],
"main": [
"iron-range-behavior.html"
],
"main": "iron-range-behavior.html",
"private": true,
"repository": {
"type": "git",
@ -24,15 +22,16 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-input": "PolymerElements/iron-input#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/PolymerElements/iron-range-behavior",
"_release": "1.0.4",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.4",
"commit": "71774a7d8a8c377496bfe05e60b754e91216e0b9"
"tag": "v1.0.5",
"commit": "645ffc6b39ae4fb0efd23b97016a9c4aac777978"
},
"_source": "git://github.com/PolymerElements/iron-range-behavior.git",
"_target": "^1.0.0",

View File

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/iron-range-behavior/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View File

@ -0,0 +1,23 @@
language: node_js
sudo: required
before_script:
- npm install -g bower polylint web-component-tester
- bower install
- polylint
env:
global:
- secure: IsCzwFlF0UR02RUnxyo+Gk4cdZMLDOVdy3X0qE7JCe3Lo/SJXjULrJMUZmHrKV9yQTu8bke5lhJdMe/8kuO7chLekQv4AF5bR2m3x7Kg4oJGQJE30WpBWXz6XSYuwnmOINmaNqNZKil692W28LFr97N2+TxEbE64lTd5cGcgJDI=
- secure: TmQz2J5KMg/5dOi/7VDMWIxLoHjC5K7yCQAQOkcrq9M8PTBQE2wlCVe4wb6EqfiAofBv5e4heO9B3F0EOWWp2Sasa9ZQIcs0Lg/1SU6wv5Vt9XCONu/ZLI9oqG3SJ8pMMhcexMxmygX0wsytuI6LOI3sMMpOek2cdae1ntPT9IE=
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
sauce_connect: true
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
dist: trusty

View File

@ -0,0 +1,77 @@
<!--
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 :)
You can however override the jsbin link with one that's customized to this
specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# 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: [https://jsbin.com/cagaye/edit?html,output](https://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 in the pull request description using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, fixes #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-range-behavior",
"version": "1.0.4",
"version": "1.0.5",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for something with a minimum and maximum value",
"authors": "The Polymer Authors",
@ -9,9 +9,7 @@
"polymer",
"behavior"
],
"main": [
"iron-range-behavior.html"
],
"main": "iron-range-behavior.html",
"private": true,
"repository": {
"type": "git",
@ -24,7 +22,8 @@
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-input": "PolymerElements/iron-input#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
},
"ignore": []
}

View File

@ -83,18 +83,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_calcStep: function(value) {
/**
* if we calculate the step using
* `Math.round(value / step) * step` we may hit a precision point issue
* eg. 0.1 * 0.2 = 0.020000000000000004
* http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
*
* as a work around we can divide by the reciprocal of `step`
*/
// polymer/issues/2493
value = parseFloat(value);
return this.step ? (Math.round((value + this.min) / this.step) -
(this.min / this.step)) / (1 / this.step) : value;
if (!this.step) {
return value;
}
var numSteps = Math.round((value - this.min) / this.step);
if (this.step < 1) {
/**
* For small values of this.step, if we calculate the step using
* `Math.round(value / step) * step` we may hit a precision point issue
* eg. 0.1 * 0.2 = 0.020000000000000004
* http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
*
* as a work around we can divide by the reciprocal of `step`
*/
return numSteps / (1 / this.step) + this.min;
} else {
return numSteps * this.step + this.min;
}
},
_validateValue: function() {

View File

@ -103,6 +103,33 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('set large step', function(done) {
// PolymerElements/paper-slider#135
range.min = 0;
range.max = 2625;
range.step = 875;
range.value = 875;
flush(function() {
assert.equal(range.value, 875);
done();
});
});
test('set step with min', function(done) {
range.min = -0.9;
range.max = 1.1;
range.step = 0.5;
range.value = -0.5;
flush(function() {
assert.equal(range.value, -0.4);
range.value = 0.7;
flush(function() {
assert.equal(range.value, 0.6);
done();
});
});
});
test('odd values', function(done) {
range.min = 1;
range.max = 7;

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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Tests</title>
@ -18,8 +15,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script>
WCT.loadSuites([
'basic.html'
'basic.html',
'basic.html?dom=shadow'
]);
</script>
</body>
</html>
</body></html>

View File

@ -1,4 +1,5 @@
<!--
@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

View File

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.10",
"version": "1.0.11",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",
@ -36,11 +36,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/paper-slider",
"_release": "1.0.10",
"_release": "1.0.11",
"_resolution": {
"type": "version",
"tag": "v1.0.10",
"commit": "9b71cd988af6b000403a6f59c51ea6c789ded930"
"tag": "v1.0.11",
"commit": "855e3ed20d12b4545175317536adca7897928537"
},
"_source": "git://github.com/PolymerElements/paper-slider.git",
"_target": "~1.0.3",

View File

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/paper-slider/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View File

@ -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: W9pv3wK5AyI038GpPZpFo5yii72up1pTHM9yu8TI4th6Q/TiUQCa8GbjAMhUcbMDl3Y4i50WjckykSox+c506Zs5Pe5vDCaKpHT/iOHYqjIaQEDGGvvKWxSTJr82HY2taNhkH7seksg7oKq8dL7DCBLyKJUl03hGmRqZABjIw9fWjSNUb9PVdlZass5nJaqw954t76GYBWcQ71fntm8uCnSrQoviHEprvfwZMNnK0mhd79VmBohl83jpFU8FaYEWLc5IFY29u7McLxgynZBggwhGSrvdDrOYG4jtn26RNx4mNCcJGxejzadvf4K6H2S45SGnsCIjJRJbl8MV+ni18VqC/BuCF2J4k8QqSRtWi2mSq/l9DOgIiwViPRjPRxoK+a+/6qA7pQ1aMXBWWF4FjngvgoZHcY2J5FptbRltDtalrUSbUVmmKNoWwaJa4Sb5OopJdr0herGds946qzQKW1FLqkcDTtF6c4fZqK12WVEIXZLXiP9sV9+dBJDXT4oWzgjo2GHAiMEzV6Xk3oZ/RHmWJ34Bemy7M5zYKDHErLhD6/UXiA/tYlTqqgu/4Jdxs07ilWmaVd3kTYywRYuTzR4yO3xq8ElpEnpby2WobGiVCsuzQwOe4fWSvV4wS8TpSdigoGxYQ+FPrrbc7jhgRodyZP1xF/mTHlIvNmaTYYc=
- secure: xLLhaBejrIuYAxwQoFPsrvnBpeDVY8IYdThJ36fJnD4V0jpqS7m8b2rw5fYrtwWvmEAQlqJ20/hnjfp9kKXr6Qpkj2im9d0KWdw4xAyD2KxiG/u5pBn1Y+zE9iGjq+NGa58EJDNaxQSnaXmVnk55tyT9W3ailkiO/lEtaofXXXGqiW9Nxa9D0GtbbNWBypcoc7X/HXCcg5hVpdVjEFh3Y+nFWIdqJEO0V7oKujfb5yFhu5PRU7siTzdN+nLoPXPMlkBa3aWwPLdM1D9HKXN1jBX6dM9dH3oz20K/TCPpbO5u675vfuTT9iP9XuLy4LB/cl7S6bcopvhU5ipkQvLEieeq73EP1hz5vwdSWgleXkNhWBInhzeHLTI04M49ZxIc0NEay2Tvx9tQl5e8BT1/WglpjnHvqx/VoF7zkHRfWyWeObL6YyFVFiJ0Gz3ExJTUCruQRBen+g2Cqr1qwBN4bFPhgxzHW58ECdsDFvfpZT3I7h/wnCzNVOZx+A74nVwDpl6zg+/+GWpqZF2ILGbRDTcjp1A/eH+FMwnQccRLiBcXm4v4y8pFfaNzjRwswUQjnMV5KyIV+dSyQQAh9sBedFJjeWm1HSy3UXFZvyc6gQIG5GR5uGWkyxYHdCxBFMYFj2xmEzoLwF7omu5CXF0TUdYxb5hvUBMEqEEKIwte2VE=
- 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

View File

@ -1,4 +1,3 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
@ -11,6 +10,7 @@ specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# Polymer Elements
## Guide for Contributors

View File

@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.10",
"version": "1.0.11",
"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",

View File

@ -42,6 +42,7 @@ The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------|-------------|----------
`--paper-slider-container-color` | The background color of the bar | `--paper-grey-400`
`--paper-slider-bar-color` | The background color of the slider | `transparent`
`--paper-slider-active-color` | The progress bar color | `--google-blue-700`
`--paper-slider-secondary-color` | The secondary progress bar color | `--google-blue-300`
@ -131,7 +132,7 @@ Custom property | Description | Default
padding: 15px 0;
width: 100%;
background-color: var(--paper-slider-bar-color, transparent);
--paper-progress-container-color: var(--paper-grey-400);
--paper-progress-container-color: var(--paper-slider-container-color, --paper-grey-400);
--paper-progress-height: var(--paper-slider-height, 2px);
}
@ -301,7 +302,6 @@ Custom property | Description | Default
<div id="sliderContainer"
class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
<div class="bar-container">
<paper-progress
disabled$="[[disabled]]"
@ -331,7 +331,7 @@ Custom property | Description | Default
on-up="_resetKnob"
on-track="_onTrack"
on-transitionend="_knobTransitionEnd">
<div id="sliderKnobInner" value$="[[pinValue]]"></div>
<div id="sliderKnobInner" value$="[[immediateValue]]"></div>
</div>
</div>
@ -420,8 +420,7 @@ Custom property | Description | Default
maxMarkers: {
type: Number,
value: 0,
notify: true,
observer: '_maxMarkersChanged'
notify: true
},
/**
@ -458,7 +457,8 @@ Custom property | Description | Default
observers: [
'_updateKnob(value, min, max, snaps, step)',
'_valueChanged(value)',
'_immediateValueChanged(immediateValue)'
'_immediateValueChanged(immediateValue)',
'_updateMarkers(maxMarkers, min, max, snaps)'
],
hostAttributes: {
@ -471,13 +471,6 @@ Custom property | Description | Default
'right up pageup end': '_incrementKey'
},
ready: function() {
// issue polymer/polymer#1305
this.async(function() {
this._updateKnob(this.value);
}, 1);
},
/**
* Increases value by `step` but not above `max`.
* @method increment
@ -528,8 +521,7 @@ Custom property | Description | Default
},
_positionKnob: function(ratio) {
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
this._setPinValue(this.immediateValue);
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
this._setRatio(this._calcRatio(this.immediateValue));
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
@ -583,7 +575,6 @@ Custom property | Description | Default
// update knob's position
var translateX = ((this._calcRatio(this.immediateValue) * this._w) - this._knobstartx);
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
this._setPinValue(this.immediateValue);
},
_trackEnd: function() {
@ -598,9 +589,6 @@ Custom property | Description | Default
this.fire('change');
},
_setPinValue: function (value) {
this.pinValue = value;
},
_knobdown: function(event) {
this._expandKnob();
@ -649,11 +637,11 @@ Custom property | Description | Default
}
},
_maxMarkersChanged: function(maxMarkers) {
if (!this.snaps) {
_updateMarkers: function(maxMarkers, min, max, snaps) {
if (!snaps) {
this._setMarkers([]);
}
var steps = Math.round((this.max - this.min) / this.step);
var steps = Math.round((max - min) / this.step);
if (steps > maxMarkers) {
steps = maxMarkers;
}
@ -743,7 +731,12 @@ Custom property | Description | Default
*/
/**
* Fired when the slider's immediateValue changes.
* Fired when the slider's immediateValue changes. Only occurs while the
* user is dragging.
*
* To detect changes to immediateValue that happen for any input (i.e.
* dragging, tapping, clicking, etc.) listen for immediate-value-changed
* instead.
*
* @event immediate-value-change
*/

View File

@ -24,7 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<test-fixture id="trivialSlider">
<template>
<paper-slider min="0" max="100" value="50"></paper-slider>
<paper-slider value="50"></paper-slider>
</template>
</test-fixture>
@ -36,11 +36,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
slider = fixture('trivialSlider');
});
test('has aria role "slider"', function() {
assert.equal(slider.getAttribute('role'), 'slider');
assert.equal(slider.getAttribute('aria-valuemin'), slider.min);
assert.equal(slider.getAttribute('aria-valuemax'), slider.max);
assert.equal(slider.getAttribute('aria-valuenow'), slider.value);
test('has aria role "slider"', function(done) {
flush(function() {
assert.equal(slider.getAttribute('role'), 'slider');
assert.equal(slider.getAttribute('aria-valuemin'), slider.min);
assert.equal(slider.getAttribute('aria-valuemax'), slider.max);
assert.equal(slider.getAttribute('aria-valuenow'), slider.value);
done();
});
});
test('ripple is added after keyboard event on knob', function() {