Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from PolymerElements/iron
Browse files Browse the repository at this point in the history
core- -> iron-, fix bower.json
  • Loading branch information
Yvonne Yip committed Apr 16, 2015
2 parents e402e81 + 9c9ab08 commit abd6b3c
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/node_modules/
bower_components
.DS_Store
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
core-selector
iron-selector
=============

See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-selector) for more information.
22 changes: 12 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "core-selector",
"name": "iron-selector",
"version": "0.8.0",
"private": true,
"main": "core-selector.html",
"authors": [
"Frankie Fu <ffu@google.com>",
"The Polymer Authors"
"main": [
"iron-selector.html"
],
"repository": "https://github.com/Polymer/core-selector/tree/0.8-preview",
"authors": "The Polymer Authors",
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-selector.git"
},
"dependencies": {
"polymer": "Polymer/polymer#0.8-preview"
"polymer": "Polymer/polymer#v0.8.0-rc.4"
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs",
"web-component-tester": "*",
"test-fixture": "Polymer/test-fixture#master"
"test-fixture": "PolymerElements/test-fixture#^0.8.0",
"web-component-tester": "Polymer/web-component-tester#^2.2.3",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.6.0"
}
}
16 changes: 8 additions & 8 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
<html>
<head>

<title>core-selector</title>
<title>iron-selector</title>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../core-selector.html">
<link rel="import" href="../iron-selector.html">

<style>

core-selector > * {
iron-selector > * {
padding: 16px;
}

.core-selected {
.iron-selected {
background-color: #ddd;
}

Expand All @@ -35,20 +35,20 @@
<body>

<h3>Example 1</h3>
<core-selector selected="0">
<iron-selector selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</core-selector>
</iron-selector>

<h3>Example 2</h3>
<core-selector selected="foo" attr-for-selected="name">
<iron-selector selected="foo" attr-for-selected="name">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="zot">Zot</div>
</core-selector>
</iron-selector>

</body>
</html>
14 changes: 7 additions & 7 deletions core-selectable.html → iron-selectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
-->

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="core-selection.html">
<link rel="import" href="iron-selection.html">

<script>

/**
FIXME(ffu): should probably move it to its own repo.
`core-selectable` is a mixin that can be used to manage a list of elements
`iron-selectable` is a mixin that can be used to manage a list of elements
that can be selected.
FIXME(ffu): currently the element using `core-selectable` must bind the `selected` property to
FIXME(ffu): currently the element using `iron-selectable` must bind the `selected` property to
`_selectedChanged`, e.g.
bind: {
Expand All @@ -28,7 +28,7 @@
callback.
@group Polymer Mixins
@element core-selectable
@element iron-selectable
@homepage github.io
*/
Polymer.Core.Selectable = {
Expand All @@ -44,7 +44,7 @@
/* attrForSelected: 'name' */

/* The class to set on elements when selected */
selectedClass: 'core-selected',
selectedClass: 'iron-selected',

/* The attribute to set on elements when selected */
/* selectedAttribute: 'active', */
Expand Down Expand Up @@ -114,7 +114,7 @@

get selection() {
if (!this._selection) {
this._selection = new CoreSelection(this.applySelection.bind(this));
this._selection = new IronSelection(this.applySelection.bind(this));
}
return this._selection;
},
Expand Down Expand Up @@ -176,7 +176,7 @@
if (this.selectedAttribute) {
this.toggleAttribute(this.selectedAttribute, isSelected, item);
}
this.fire('core-' + (isSelected ? 'select' : 'deselect'), {item: item});
this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item});
},

/**
Expand Down
6 changes: 3 additions & 3 deletions core-selection.html → iron-selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

<script>

function CoreSelection(selectCallback) {
function IronSelection(selectCallback) {
this.selection = [];
this.selectCallback = selectCallback;
}

CoreSelection.prototype = {
IronSelection.prototype = {

/**
* Retrieves the selected item(s).
Expand Down Expand Up @@ -108,6 +108,6 @@
};

Polymer.Core = Polymer.Core || {};
Polymer.Core.Selection = CoreSelection;
Polymer.Core.Selection = IronSelection;

</script>
26 changes: 13 additions & 13 deletions core-selector.html → iron-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,61 @@
-->

<!--
`core-selector` is an element which can be used to manage a list of elements
`iron-selector` is an element which can be used to manage a list of elements
that can be selected. Tapping on the item will make the item selected. The `selected` indicates
which item is being selected. The default is to use the index of the item.
Example:
<core-selector selected="0">
<iron-selector selected="0">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</core-selector>
</iron-selector>
If you want to use the attribute value of an element for `selected` instead of the index,
set `attrForSelected` to the name of the attribute. For example, if you want to select item by
`name`, set `attrForSelected` to `name`.
Example:
<core-selector attr-for-selected="name" selected="foo">
<iron-selector attr-for-selected="name" selected="foo">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="zot">Zot</div>
</core-selector>
</iron-selector>
`core-selector` is not styled. Use the `core-selected` CSS class to style the selected element.
`iron-selector` is not styled. Use the `iron-selected` CSS class to style the selected element.
Example:
<style>
.core-selected {
.iron-selected {
background: #eee;
}
</style>
...
<core-selector selected="0">
<iron-selector selected="0">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</core-selector>
</iron-selector>
@group Polymer Core Elements
@element core-selector
@element iron-selector
@homepage github.io
-->

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="core-selectable.html">
<link rel="import" href="iron-selectable.html">

<script>

Polymer({

is: 'core-selector',
is: 'iron-selector',

mixins: [
Polymer.Core.Selectable
Expand Down Expand Up @@ -188,7 +188,7 @@
var i = items.indexOf(t);
if (i >= 0) {
var value = this.indexToValue(i);
if (!this.fire('core-activate', {selected: value, item: t}).defaultPrevented) {
if (!this.fire('iron-activate', {selected: value, item: t}).defaultPrevented) {
this.select(value);
}
return;
Expand Down
34 changes: 17 additions & 17 deletions test/activate-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
<html>
<head>

<title>core-selector-activate-event</title>
<title>iron-selector-activate-event</title>
<meta charset="UTF-8">

<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="../core-selector.html">
<link rel="import" href="../iron-selector.html">

<style>
.core-selected {
.iron-selected {
background: #ccc;
}
</style>
Expand All @@ -32,13 +32,13 @@

<test-fixture id="test">
<template>
<core-selector id="selector" selected="0">
<iron-selector id="selector" selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</core-selector>
</iron-selector>
</template>
</test-fixture>

Expand All @@ -60,11 +60,11 @@
assert.equal(s.selected, '1');
});

test('activates on click and fires core-activate', function(done) {
test('activates on click and fires iron-activate', function(done) {
assert.equal(s.selected, '0');

// attach core-activate listener
s.addEventListener("core-activate", function(event) {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '1');
assert.equal(event.detail.item, s.children[1]);
done();
Expand All @@ -74,11 +74,11 @@
s.children[1].dispatchEvent(new CustomEvent('click', {bubbles: true}));
});

test('click on already selected and fires core-activate', function(done) {
test('click on already selected and fires iron-activate', function(done) {
assert.equal(s.selected, '0');

// attach core-activate listener
s.addEventListener("core-activate", function(event) {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '0');
assert.equal(event.detail.item, s.children[0]);
done();
Expand All @@ -96,9 +96,9 @@
assert.equal(s.selected, '2');
});

test('activates on mousedown and fires core-activate', function(done) {
// attach core-activate listener
s.addEventListener("core-activate", function(event) {
test('activates on mousedown and fires iron-activate', function(done) {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '2');
assert.equal(event.detail.item, s.children[2]);
done();
Expand All @@ -120,13 +120,13 @@
});

test('activates on click and preventDefault', function() {
// attach core-activate listener
s.addEventListener("core-activate", function(event) {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
event.preventDefault();
});
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('click', {bubbles: true}));
// shouldn't got selected since we preventDefault in core-activate
// shouldn't got selected since we preventDefault in iron-activate
assert.equal(s.selected, '0');
});

Expand Down
Loading

0 comments on commit abd6b3c

Please sign in to comment.