Skip to content

Commit

Permalink
Merge branch 'release/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilujD committed Nov 7, 2016
2 parents 2b9aba5 + 5fa8b5d commit edd4189
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: node_js
sudo: required
before_script:
- npm install -g bower polymer-cli
- bower install
- polymer lint --input paper-buttons-group.html
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
script:
- polymer test
dist: trusty
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/NeilujD/paper-buttons-group.svg?branch=develop)](https://travis-ci.org/NeilujD/paper-buttons-group)

[Demo and API Docs](https://neilujd.github.io/paper-buttons-group)

# \<paper-buttons-group\>
Expand Down
5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paper-buttons-group",
"version": "1.2.0",
"version": "1.2.1",
"description": "A button group with paper-button style",
"homepage": "https://neilujd.github.io/paper-buttons-group",
"authors": [
Expand Down Expand Up @@ -34,6 +34,7 @@
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.20",
"iron-icon": "PolymerElements/iron-icon#^1.0.11",
"iron-icons": "PolymerElements/iron-icons#^1.1.3"
"iron-icons": "PolymerElements/iron-icons#^1.1.3",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.2.5"
}
}
48 changes: 27 additions & 21 deletions test/paper-buttons-group_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>

<link rel="import" href="../../paper-button/paper-button.html">

Expand Down Expand Up @@ -52,48 +53,53 @@

<script>
suite('paper-buttons-group', function() {
var basicElement,
simpleChoiceElement,
multiChoicesElement,
attrForSelectedElement;

setup(function() {
basicElement = fixture('basic');
simpleChoiceElement = fixture('simpleChoice');
multiChoicesElement = fixture('multiChoices');
attrForSelectedElement = fixture('attrForSelectedChoice');
});

test('instantiating the element works', function() {
var element = fixture('basic');
assert.equal(element.is, 'paper-buttons-group');
assert.equal(basicElement.is, 'paper-buttons-group');
});

test('select with `select` method simple choice works', function () {
var element = fixture('simpleChoice');
element.select(1);
assert.equal(element.selected, 1);
simpleChoiceElement.select(1);
assert.equal(simpleChoiceElement.selected, 1);
});

test('select by taping on a choice works', function () {
var element = fixture('simpleChoice');
var choice = document.getElementById("simpleChoice2");
choice.fire("tap");
assert.equal(element.selected, 1);
MockInteractions.tap(choice);
assert.equal(simpleChoiceElement.selected, 1);
});

test('select with `select` method multi choice works', function () {
var element = fixture('multiChoices');
element.select(0);
element.select(1);
assert.deepEqual(element.selectedValues, [0, 1]);
multiChoicesElement.select(0);
multiChoicesElement.select(1);
assert.deepEqual(multiChoicesElement.selectedValues, [0, 1]);
});

test('select by taping on mutil choices', function () {
var element = fixture('multiChoices');
var choice1 = document.getElementById("multiChoice1");
var choice2 = document.getElementById("multiChoice2");
var choice3 = document.getElementById("multiChoice3");
choice1.fire("tap");
choice1.fire("tap");
choice2.fire("tap");
choice3.fire("tap");
assert.deepEqual(element.selectedValues, [1, 2]);
MockInteractions.tap(choice1);
MockInteractions.tap(choice1);
MockInteractions.tap(choice2);
MockInteractions.tap(choice3);
assert.deepEqual(multiChoicesElement.selectedValues, [1, 2]);
});

test('select with `select` method simple choice with `attrForSelected` works', function () {
var element = fixture('attrForSelectedChoice');
element.select("choice2");
assert.equal(element.selected, "choice2");
attrForSelectedElement.select("choice2");
assert.equal(attrForSelectedElement.selected, "choice2");
});

});
Expand Down

0 comments on commit edd4189

Please sign in to comment.