mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
remove unused components
This commit is contained in:
parent
5838163be6
commit
9de658be0b
22 changed files with 0 additions and 1463 deletions
|
@ -1,47 +0,0 @@
|
|||
{
|
||||
"name": "paper-radio-button",
|
||||
"version": "1.0.12",
|
||||
"description": "A material design radio button",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"radio",
|
||||
"control"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-radio-button"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-radio-button",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
|
||||
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
|
||||
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^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.3.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "paper-radio-button.html",
|
||||
"_release": "1.0.12",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.12",
|
||||
"commit": "d7a5a090968c8448d7568208e05fb626fe74ab64"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-radio-button.git",
|
||||
"_target": "~1.0.5",
|
||||
"_originalSource": "PolymerElements/paper-radio-button"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
bower_components
|
|
@ -1,24 +0,0 @@
|
|||
language: node_js
|
||||
sudo: false
|
||||
before_script:
|
||||
- npm install web-component-tester
|
||||
- npm install bower
|
||||
- 'export PATH=$PWD/node_modules/.bin:$PATH'
|
||||
- bower install
|
||||
- npm install polylint
|
||||
- polylint
|
||||
env:
|
||||
global:
|
||||
- secure: P6B/39IMzhm/jBmxD+0CDZEPYNMMaizAgpn4MXUUlAmmdMJNwovzvm/kYtVyoPfGiJ08NJh5tNRLQbkG12OH71lQ7ReTiru0hEy93ssmIh0U6ZUAAxTZVQ9SxB5gjrQU8/0fVJ9tNd0kBklHH4FoK+ZtJurhKLJaXhXsupXpcuI=
|
||||
- secure: rxY6LCY199Lt1aRGK8Hpq3wjx8xcpb91x21fJStKROlpJTlfp+c0yevK1oYkklzChJWEFewFNTYlHbm9pc7TCyXK2WCR0v1GgSeJAUpP4TONkdpueeOvsVC/CGB9mIXEtfUEh2CCdWDj+D7JGLdUvbgmu8C3gfqfP+AyXbQt5Jc=
|
||||
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"
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
<!--
|
||||
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 user’s 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 don’t be afraid to ask us if you need help with that!
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"name": "paper-radio-button",
|
||||
"version": "1.0.12",
|
||||
"description": "A material design radio button",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"radio",
|
||||
"control"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-radio-button"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-radio-button",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
|
||||
"paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0",
|
||||
"paper-ripple": "PolymerElements/paper-ripple#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^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.3.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "paper-radio-button.html"
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
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
|
||||
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>
|
||||
<title>paper-radio-button demo</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
|
||||
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
|
||||
<link rel="import" href="../paper-radio-button.html">
|
||||
|
||||
<style is="custom-style" include="demo-pages-shared-styles">
|
||||
.vertical-section-container {
|
||||
max-width: 630px;
|
||||
}
|
||||
|
||||
paper-radio-button {
|
||||
margin-right: 24px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body unresolved>
|
||||
<div class="vertical-section-container centered">
|
||||
<h3>Radio buttons can be checked or unchecked, or disabled entirely</h3>
|
||||
<demo-snippet class="centered-demo">
|
||||
<template>
|
||||
<paper-radio-button>Radio</paper-radio-button>
|
||||
<paper-radio-button checked>Radio</paper-radio-button>
|
||||
<paper-radio-button disabled>Disabled</paper-radio-button>
|
||||
</template>
|
||||
</demo-snippet>
|
||||
|
||||
<h3>Radio buttons can hide the ripple effect using the <i>noink</i> attribute</h3>
|
||||
<demo-snippet class="centered-demo">
|
||||
<template>
|
||||
<paper-radio-button noink>Radio</paper-radio-button>
|
||||
</template>
|
||||
</demo-snippet>
|
||||
|
||||
<h3>Radio buttons can be styled using custom properties</h3>
|
||||
<demo-snippet class="centered-demo">
|
||||
<template>
|
||||
<style is="custom-style">
|
||||
paper-radio-button.red {
|
||||
--paper-radio-button-checked-color: var(--paper-red-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-red-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-red-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-red-900);
|
||||
--paper-radio-button-label-color: var(--paper-red-500);
|
||||
}
|
||||
paper-radio-button.green {
|
||||
--paper-radio-button-checked-color: var(--paper-green-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-green-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-green-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-green-900);
|
||||
--paper-radio-button-label-color: var(--paper-green-500);
|
||||
}
|
||||
</style>
|
||||
|
||||
<paper-radio-button class="red">Radio</paper-radio-button>
|
||||
<paper-radio-button checked class="green">Radio</paper-radio-button>
|
||||
</template>
|
||||
</demo-snippet>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
||||
<g id="background" display="none">
|
||||
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
||||
</g>
|
||||
<g id="label">
|
||||
</g>
|
||||
<g id="art">
|
||||
<g>
|
||||
<circle cx="112.5" cy="63" r="8"/>
|
||||
<path d="M112.5,80c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,80,112.5,80z M112.5,48c-8.3,0-15,6.7-15,15s6.7,15,15,15
|
||||
s15-6.7,15-15S120.8,48,112.5,48z"/>
|
||||
</g>
|
||||
<g id="ic_x5F_add_x0D_">
|
||||
</g>
|
||||
</g>
|
||||
<g id="Guides">
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 848 B |
|
@ -1,29 +0,0 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
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
|
||||
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>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<title>paper-radio-button</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,220 +0,0 @@
|
|||
<!--
|
||||
@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
|
||||
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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html">
|
||||
<link rel="import" href="../paper-ripple/paper-ripple.html">
|
||||
<link rel="import" href="../paper-styles/default-theme.html">
|
||||
|
||||
<!--
|
||||
Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button)
|
||||
|
||||
`paper-radio-button` is a button that can be either checked or unchecked.
|
||||
User can tap the radio button to check or uncheck it.
|
||||
|
||||
Use a `<paper-radio-group>` to group a set of radio buttons. When radio buttons
|
||||
are inside a radio group, exactly one radio button in the group can be checked
|
||||
at any time.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-radio-button></paper-radio-button>
|
||||
<paper-radio-button>Item label</paper-radio-button>
|
||||
|
||||
### Styling
|
||||
|
||||
The following custom properties and mixins are available for styling:
|
||||
|
||||
Custom property | Description | Default
|
||||
----------------|-------------|----------
|
||||
`--paper-radio-button-unchecked-background-color` | Radio button background color when the input is not checked | `transparent`
|
||||
`--paper-radio-button-unchecked-color` | Radio button color when the input is not checked | `--primary-text-color`
|
||||
`--paper-radio-button-unchecked-ink-color` | Selected/focus ripple color when the input is not checked | `--primary-text-color`
|
||||
`--paper-radio-button-checked-color` | Radio button color when the input is checked | `--default-primary-color`
|
||||
`--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
|
||||
`--paper-radio-button-label-color` | Label color | `--primary-text-color`
|
||||
`--paper-radio-button-label-spacing` | Spacing between the label and the button | `10px`
|
||||
|
||||
@group Paper Elements
|
||||
@element paper-radio-button
|
||||
@hero hero.svg
|
||||
@demo demo/index.html
|
||||
-->
|
||||
|
||||
<dom-module id="paper-radio-button">
|
||||
<template strip-whitespace>
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:host(:focus) {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#radioContainer {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#ink {
|
||||
position: absolute;
|
||||
top: -16px;
|
||||
left: -16px;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: var(--paper-radio-button-unchecked-ink-color, --primary-text-color);
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
:host-context([dir="rtl"]) #ink {
|
||||
right: -15px;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
#ink[checked] {
|
||||
color: var(--paper-radio-button-checked-ink-color, --default-primary-color);
|
||||
}
|
||||
|
||||
#offRadio {
|
||||
position: absolute;
|
||||
box-sizing: content-box;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
border: solid 2px;
|
||||
background-color: var(--paper-radio-button-unchecked-background-color, transparent);
|
||||
border-color: var(--paper-radio-button-unchecked-color, --primary-text-color);
|
||||
transition: border-color 0.28s;
|
||||
}
|
||||
|
||||
#onRadio {
|
||||
position: absolute;
|
||||
box-sizing: content-box;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
right: 4px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--paper-radio-button-checked-color, --default-primary-color);
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
transition: -webkit-transform ease 0.28s;
|
||||
transition: transform ease 0.28s;
|
||||
}
|
||||
|
||||
:host([checked]) #offRadio {
|
||||
border-color: var(--paper-radio-button-checked-color, --default-primary-color);
|
||||
}
|
||||
|
||||
:host([checked]) #onRadio {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
#radioLabel {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: var(--paper-radio-button-label-spacing, 10px);
|
||||
white-space: normal;
|
||||
pointer-events: none;
|
||||
color: var(--paper-radio-button-label-color, --primary-text-color);
|
||||
}
|
||||
|
||||
:host-context([dir="rtl"]) #radioLabel {
|
||||
margin-left: 0px;
|
||||
margin-right: var(--paper-radio-button-label-spacing, 10px);
|
||||
}
|
||||
|
||||
#radioLabel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* disabled state */
|
||||
:host([disabled]) {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
:host([disabled]) #offRadio {
|
||||
border-color: var(--paper-radio-button-unchecked-color, --primary-text-color);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
:host([disabled][checked]) #onRadio {
|
||||
background-color: var(--paper-radio-button-unchecked-color, --primary-text-color);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
:host([disabled]) #radioLabel {
|
||||
/* slightly darker than the button, so that it's readable */
|
||||
opacity: 0.65;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="radioContainer">
|
||||
<div id="offRadio"></div>
|
||||
<div id="onRadio"></div>
|
||||
</div>
|
||||
|
||||
<div id="radioLabel"><content></content></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'paper-radio-button',
|
||||
|
||||
behaviors: [
|
||||
Polymer.PaperCheckedElementBehavior
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
role: 'radio',
|
||||
'aria-checked': false,
|
||||
tabindex: 0
|
||||
},
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* Fired when the checked state changes due to user interaction.
|
||||
*
|
||||
* @event change
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the checked state changes.
|
||||
*
|
||||
* @event iron-change
|
||||
*/
|
||||
|
||||
ariaActiveAttribute: {
|
||||
type: String,
|
||||
value: 'aria-checked'
|
||||
}
|
||||
},
|
||||
|
||||
// create the element ripple inside the `radioContainer`
|
||||
_createRipple: function() {
|
||||
this._rippleContainer = this.$.radioContainer;
|
||||
return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</dom-module>
|
|
@ -1,114 +0,0 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
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
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-radio-button basic tests</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../paper-radio-button.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="NoLabel">
|
||||
<template>
|
||||
<paper-radio-button id="radio1"></paper-radio-button>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="WithLabel">
|
||||
<template>
|
||||
<paper-radio-button id="radio2">Batman</paper-radio-button>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="AriaLabel">
|
||||
<template>
|
||||
<paper-radio-button aria-label="Batman">Robin</paper-radio-button>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('defaults', function() {
|
||||
var r1;
|
||||
|
||||
setup(function() {
|
||||
r1 = fixture('NoLabel');
|
||||
});
|
||||
|
||||
test('check button via click', function(done) {
|
||||
r1.addEventListener('click', function() {
|
||||
assert.isTrue(r1.getAttribute('aria-checked') == 'true');
|
||||
assert.isTrue(r1.checked);
|
||||
done();
|
||||
});
|
||||
MockInteractions.tap(r1);
|
||||
});
|
||||
|
||||
test('toggle button via click', function(done) {
|
||||
r1.checked = true;
|
||||
r1.addEventListener('click', function() {
|
||||
assert.isFalse(r1.getAttribute('aria-checked') == 'true');
|
||||
assert.isFalse(r1.checked);
|
||||
done();
|
||||
});
|
||||
MockInteractions.tap(r1);
|
||||
});
|
||||
|
||||
test('disabled button cannot be clicked', function(done) {
|
||||
r1.disabled = true;
|
||||
r1.checked = true;
|
||||
MockInteractions.tap(r1);
|
||||
|
||||
setTimeout(function() {
|
||||
assert.isTrue(r1.getAttribute('aria-checked') == 'true');
|
||||
assert.isTrue(r1.checked);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('a11y', function() {
|
||||
var r1;
|
||||
var r2;
|
||||
|
||||
setup(function() {
|
||||
r1 = fixture('NoLabel');
|
||||
r2 = fixture('WithLabel');
|
||||
});
|
||||
|
||||
test('has aria role "radio"', function() {
|
||||
assert.isTrue(r1.getAttribute('role') == 'radio');
|
||||
assert.isTrue(r2.getAttribute('role') == 'radio');
|
||||
});
|
||||
|
||||
test('button with no label has no aria label', function() {
|
||||
assert.isTrue(!r1.getAttribute('aria-label'));
|
||||
});
|
||||
|
||||
test('button respects the user set aria-label', function() {
|
||||
var c = fixture('AriaLabel');
|
||||
assert.isTrue(c.getAttribute('aria-label') == "Batman");
|
||||
});
|
||||
|
||||
a11ySuite('NoLabel');
|
||||
a11ySuite('WithLabel');
|
||||
a11ySuite('AriaLabel');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html><!--
|
||||
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
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>paper-radio-button tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'basic.html',
|
||||
'basic.html?dom=shadow'
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
"name": "paper-radio-group",
|
||||
"version": "1.0.9",
|
||||
"description": "A group of material design radio buttons",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"radio",
|
||||
"control"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-radio-group.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-radio-group",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "paper-radio-group.html",
|
||||
"_release": "1.0.9",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.9",
|
||||
"commit": "27a8447ed1709dd1a9bef514acd7dee218604077"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-radio-group.git",
|
||||
"_target": "~1.0.4",
|
||||
"_originalSource": "PolymerElements/paper-radio-group"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
bower_components
|
|
@ -1,25 +0,0 @@
|
|||
language: node_js
|
||||
sudo: false
|
||||
before_script:
|
||||
- npm install -g bower polylint web-component-tester
|
||||
- bower install
|
||||
- polylint
|
||||
env:
|
||||
global:
|
||||
- secure: fuljRoGGYqpPmvGA/f/nsqHWRmAFSu0BpeXS838DmXDZGe2l6liTQM3WOg/zsbQimo62bzyfaX7RI0LEPv3kcdIAjxF78/0y+Gb092YOlWjBDf8+Kwz4UuxwEHQ9FRv4T0CiZnp81oo/J9DgBNUIuIKNoycVfp/GQNM7VH8NvYM=
|
||||
- secure: ibwd66QS2gTWqIW57liwNiDZE1GHmS4lJ62T4cJ1lLUV41B6pONB62fzAVtvJhLfAyQeR3cX0+grCFJtc2v94r5DhVoTAdxuM3MrYQuM+p1XNpK/UUjEkRZkSP2GxHIztXDwePe96W5DqX/C9E/KC3G00NF5/rdtTkoEe6sn0wA=
|
||||
- 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"
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
<!--
|
||||
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 user’s 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 don’t be afraid to ask us if you need help with that!
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"name": "paper-radio-group",
|
||||
"version": "1.0.9",
|
||||
"description": "A group of material design radio buttons",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"radio",
|
||||
"control"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-radio-group.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-radio-group",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-selector": "PolymerElements/iron-selector#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-radio-button": "PolymerElements/paper-radio-button#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "paper-radio-group.html"
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
<!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
|
||||
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>
|
||||
<title>paper-radio-group demo</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../../paper-radio-button/paper-radio-button.html">
|
||||
<link rel="import" href="../paper-radio-group.html">
|
||||
<link rel="import" href="../../paper-styles/demo-pages.html">
|
||||
|
||||
<style is="custom-style">
|
||||
.horizontal-section {
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
paper-radio-button.blue {
|
||||
--paper-radio-button-checked-color: var(--paper-light-blue-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-light-blue-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-light-blue-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-light-blue-900);
|
||||
}
|
||||
|
||||
paper-radio-button.red {
|
||||
--paper-radio-button-checked-color: var(--paper-red-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-red-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-red-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-red-900);
|
||||
}
|
||||
|
||||
paper-radio-button.green {
|
||||
--paper-radio-button-checked-color: var(--paper-green-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-green-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-green-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-green-900);
|
||||
}
|
||||
|
||||
paper-radio-button.orange {
|
||||
--paper-radio-button-checked-color: var(--paper-orange-500);
|
||||
--paper-radio-button-checked-ink-color: var(--paper-orange-500);
|
||||
--paper-radio-button-unchecked-color: var(--paper-orange-900);
|
||||
--paper-radio-button-unchecked-ink-color: var(--paper-orange-900);
|
||||
}
|
||||
|
||||
paper-radio-button {
|
||||
display: block;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body unresolved>
|
||||
<div class="horizontal-section-container">
|
||||
<div>
|
||||
<h4>Enabled</h4>
|
||||
<div class="horizontal-section">
|
||||
<paper-radio-group selected="c">
|
||||
<paper-radio-button name="o">Oxygen</paper-radio-button>
|
||||
<paper-radio-button name="c">Carbon</paper-radio-button>
|
||||
<paper-radio-button name="h">Hydrogen</paper-radio-button>
|
||||
<paper-radio-button name="n">Nitrogen</paper-radio-button>
|
||||
<paper-radio-button name="ca">Calcium</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>Disabled</h4>
|
||||
<div class="horizontal-section">
|
||||
<paper-radio-group selected="c">
|
||||
<paper-radio-button name="o">Oxygen</paper-radio-button>
|
||||
<paper-radio-button name="c">Carbon</paper-radio-button>
|
||||
<paper-radio-button name="h" disabled>Hydrogen</paper-radio-button>
|
||||
<paper-radio-button name="n" disabled>Nitrogen</paper-radio-button>
|
||||
<paper-radio-button name="ca">Calcium</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>Color</h4>
|
||||
<div class="horizontal-section">
|
||||
<paper-radio-group selected="c">
|
||||
<paper-radio-button name="o" class="blue">Oxygen</paper-radio-button>
|
||||
<paper-radio-button name="c" class="red">Carbon</paper-radio-button>
|
||||
<paper-radio-button name="h" class="orange">Hydrogen</paper-radio-button>
|
||||
<paper-radio-button name="n" class="green">Nitrogen</paper-radio-button>
|
||||
<paper-radio-button name="ca" class="blue">Calcium</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
||||
<g id="background" display="none">
|
||||
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
||||
</g>
|
||||
<g id="label">
|
||||
</g>
|
||||
<g id="art">
|
||||
<g>
|
||||
<circle cx="112.5" cy="41" r="8"/>
|
||||
<path d="M112.5,58c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,58,112.5,58z M112.5,26c-8.3,0-15,6.7-15,15s6.7,15,15,15
|
||||
s15-6.7,15-15S120.8,26,112.5,26z"/>
|
||||
<circle cx="112.5" cy="85" r="8"/>
|
||||
<path d="M112.5,102c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,102,112.5,102z M112.5,70c-8.3,0-15,6.7-15,15
|
||||
s6.7,15,15,15s15-6.7,15-15S120.8,70,112.5,70z"/>
|
||||
</g>
|
||||
<g id="ic_x5F_add_x0D_">
|
||||
</g>
|
||||
</g>
|
||||
<g id="Guides">
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1 KiB |
|
@ -1,30 +0,0 @@
|
|||
<!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
|
||||
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>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<title>paper-radio-group</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,185 +0,0 @@
|
|||
<!--
|
||||
@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
|
||||
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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
<link rel="import" href="../iron-selector/iron-selectable.html">
|
||||
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
|
||||
|
||||
<!--
|
||||
Material design: [Radio button](https://www.google.com/design/spec/components/selection-controls.html#selection-controls-radio-button)
|
||||
|
||||
`paper-radio-group` allows user to select at most one radio button from a set.
|
||||
Checking one radio button that belongs to a radio group unchecks any
|
||||
previously checked radio button within the same group. Use
|
||||
`selected` to get or set the selected radio button.
|
||||
|
||||
The <paper-radio-buttons> inside the group must have the `name` attribute
|
||||
set.
|
||||
|
||||
Example:
|
||||
|
||||
<paper-radio-group selected="small">
|
||||
<paper-radio-button name="small">Small</paper-radio-button>
|
||||
<paper-radio-button name="medium">Medium</paper-radio-button>
|
||||
<paper-radio-button name="large">Large</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
|
||||
Radio-button-groups can be made optional, and allow zero buttons to be selected:
|
||||
|
||||
<paper-radio-group selected="small" allow-empty-selection>
|
||||
<paper-radio-button name="small">Small</paper-radio-button>
|
||||
<paper-radio-button name="medium">Medium</paper-radio-button>
|
||||
<paper-radio-button name="large">Large</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
|
||||
See <a href="paper-radio-button">paper-radio-button</a> for more
|
||||
information about `paper-radio-button`.
|
||||
|
||||
@group Paper Elements
|
||||
@element paper-radio-group
|
||||
@hero hero.svg
|
||||
@demo demo/index.html
|
||||
-->
|
||||
|
||||
<dom-module id="paper-radio-group">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
:host ::content > * {
|
||||
padding: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<content id="items" select="*"></content>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'paper-radio-group',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.IronSelectableBehavior
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
role: 'radiogroup',
|
||||
tabindex: 0
|
||||
},
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* Fired when the radio group selection changes.
|
||||
*
|
||||
* @event paper-radio-group-changed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Overriden from Polymer.IronSelectableBehavior
|
||||
*/
|
||||
attrForSelected: {
|
||||
type: String,
|
||||
value: 'name'
|
||||
},
|
||||
|
||||
/**
|
||||
* Overriden from Polymer.IronSelectableBehavior
|
||||
*/
|
||||
selectedAttribute: {
|
||||
type: String,
|
||||
value: 'checked'
|
||||
},
|
||||
|
||||
/**
|
||||
* Overriden from Polymer.IronSelectableBehavior
|
||||
*/
|
||||
selectable: {
|
||||
type: String,
|
||||
value: 'paper-radio-button'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, radio-buttons can be deselected
|
||||
*/
|
||||
allowEmptySelection: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
|
||||
keyBindings: {
|
||||
'left up': 'selectPrevious',
|
||||
'right down': 'selectNext',
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects the given value.
|
||||
*/
|
||||
select: function(value) {
|
||||
if (this.selected) {
|
||||
var oldItem = this._valueToItem(this.selected);
|
||||
|
||||
if (this.selected == value) {
|
||||
// If deselecting is allowed we'll have to apply an empty selection.
|
||||
// Otherwise, we should force the selection to stay and make this
|
||||
// action a no-op.
|
||||
if (this.allowEmptySelection) {
|
||||
value = '';
|
||||
} else {
|
||||
if (oldItem)
|
||||
oldItem.checked = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldItem)
|
||||
oldItem.checked = false;
|
||||
}
|
||||
|
||||
Polymer.IronSelectableBehavior.select.apply(this, [value]);
|
||||
this.fire('paper-radio-group-changed');
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects the previous item. If the previous item is disabled, then it is
|
||||
* skipped, and its previous item is selected
|
||||
*/
|
||||
selectPrevious: function() {
|
||||
var length = this.items.length;
|
||||
var newIndex = Number(this._valueToIndex(this.selected));
|
||||
|
||||
do {
|
||||
newIndex = (newIndex - 1 + length) % length;
|
||||
} while (this.items[newIndex].disabled)
|
||||
|
||||
this._itemActivate(this._indexToValue(newIndex), this.items[newIndex]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects the next item. If the next item is disabled, then it is
|
||||
* skipped, and the next item after it is selected.
|
||||
*/
|
||||
selectNext: function() {
|
||||
var length = this.items.length;
|
||||
var newIndex = Number(this._valueToIndex(this.selected));
|
||||
|
||||
do {
|
||||
newIndex = (newIndex + 1 + length) % length;
|
||||
} while (this.items[newIndex].disabled)
|
||||
|
||||
this._itemActivate(this._indexToValue(newIndex), this.items[newIndex]);
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -1,243 +0,0 @@
|
|||
<!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
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-radio-group basic tests</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
<link rel="import" href="../paper-radio-group.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="NoSelection">
|
||||
<template>
|
||||
<paper-radio-group>
|
||||
<paper-radio-button name="r1">r1</paper-radio-button>
|
||||
<paper-radio-button name="r2">r2</paper-radio-button>
|
||||
<paper-radio-button name="r3">r3</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="WithSelection">
|
||||
<template>
|
||||
<paper-radio-group selected="r1">
|
||||
<paper-radio-button name="r1">r1</paper-radio-button>
|
||||
<paper-radio-button name="r2">r2</paper-radio-button>
|
||||
<paper-radio-button name="r3">r3</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="WithDisabled">
|
||||
<template>
|
||||
<paper-radio-group selected="r1">
|
||||
<paper-radio-button name="r1">r1</paper-radio-button>
|
||||
<paper-radio-button name="r2" disabled>r2</paper-radio-button>
|
||||
<paper-radio-button name="r3">r3</paper-radio-button>
|
||||
</paper-radio-group>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('defaults', function() {
|
||||
var LEFT_ARROW = 37;
|
||||
var RIGHT_ARROW = 39;
|
||||
|
||||
test('group can have no selection', function (done) {
|
||||
var g = fixture('NoSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
expect(g.selected).to.not.be.ok;
|
||||
var items = g.items;
|
||||
expect(items.length).to.be.equal(3);
|
||||
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
|
||||
done();
|
||||
}, 1);
|
||||
|
||||
});
|
||||
|
||||
test('group can have a selection', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
expect(g.selected).to.be.ok;
|
||||
var items = g.items;
|
||||
expect(items.length).to.be.equal(3);
|
||||
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
expect(items[0].getAttribute('name')).to.be.equal(g.selected);
|
||||
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('right arrow advances the selection', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
g.addEventListener('paper-radio-group-changed', function () {
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(true);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
done();
|
||||
});
|
||||
MockInteractions.keyDownOn(g, RIGHT_ARROW);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('left arrow reverses the selection', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
g.addEventListener('paper-radio-group-changed', function () {
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(true);
|
||||
done();
|
||||
});
|
||||
MockInteractions.keyDownOn(g, LEFT_ARROW);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('selection should skip disabled items', function (done) {
|
||||
var g = fixture('WithDisabled');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
g.addEventListener('paper-radio-group-changed', function () {
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(true);
|
||||
done();
|
||||
});
|
||||
MockInteractions.keyDownOn(g, RIGHT_ARROW);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('clicking should change the selection', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
g.addEventListener('paper-radio-group-changed', function () {
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(true);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
done();
|
||||
});
|
||||
MockInteractions.tap(items[1]);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('clicking the selected item should not deselect', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
// The selection should not change, but wait for a little bit just
|
||||
// in case it would and an event would be fired.
|
||||
setTimeout(function() {
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
done();
|
||||
}, 1);
|
||||
MockInteractions.tap(items[0]);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('clicking the selected item should deselect if allow-empty-selection is set', function (done) {
|
||||
var g = fixture('WithSelection');
|
||||
g.allowEmptySelection = true;
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
var items = g.items;
|
||||
expect(items[0].checked).to.be.equal(true);
|
||||
|
||||
// The selection should not change, but wait for a little bit just
|
||||
// in case it would and an event would be fired.
|
||||
setTimeout(function() {
|
||||
expect(items[0].checked).to.be.equal(false);
|
||||
expect(items[1].checked).to.be.equal(false);
|
||||
expect(items[2].checked).to.be.equal(false);
|
||||
done();
|
||||
}, 1);
|
||||
MockInteractions.tap(items[0]);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('arrow keys cause iron-activate events', function(done) {
|
||||
var g = fixture('WithSelection');
|
||||
|
||||
// Needs to be async since the underlying iron-selector uses observeNodes.
|
||||
Polymer.Base.async(function() {
|
||||
g.items[0].focus();
|
||||
|
||||
var i = 0;
|
||||
g.addEventListener('iron-activate', function() {
|
||||
switch (i++) {
|
||||
case 0:
|
||||
MockInteractions.pressAndReleaseKeyOn(g, 38);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
MockInteractions.pressAndReleaseKeyOn(g, 39);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
MockInteractions.pressAndReleaseKeyOn(g, 40);
|
||||
break;
|
||||
|
||||
default:
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(g, 37);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<!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
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>paper-radio-group tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'basic.html',
|
||||
'basic.html?dom=shadow'
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
Loading…
Add table
Add a link
Reference in a new issue