Skip to content

Commit

Permalink
Added tests ready for release of new version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwragg committed Sep 29, 2016
1 parent 25eb7fc commit 9822528
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "px-data-table",
"version": "1.13.4",
"version": "1.14.0",
"main": [
"px-data-table.html"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "px-data-table",
"author": "General Electric",
"description": "A Px component",
"version": "1.13.4",
"version": "1.14.0",
"extName": null,
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion px-data-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
},

/**
* Property to set the page size instead of the default of 10.
* Property to set the table page size.
*
* <px-data-table page-size="50" table-data="{{data}}"></px-data-table>
*
Expand Down
26 changes: 26 additions & 0 deletions test/px-data-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,4 +1334,30 @@ function runTests() {
});
});
});

suite('Unit Tests for page size property', function () {

test('Default pagination size is 10', function(){
assert.equal(table1Fixture.pageSize, 10, 'Default page size should be 10 rows.');
});

test('Default rows displayed size is 10', function(){
var tb = Polymer.dom(table1Fixture.root).querySelector('aha-table'),
rowCount = Polymer.dom(tb.root).querySelectorAll('.rows').length;
assert.equal(rowCount, 10, 'Default rows displayed should be 10 rows.');
});

test('Switching pageSize property to 20 should make table re-render', function(done){
var tb = Polymer.dom(table1Fixture.root).querySelector('aha-table'),
rowCount = Polymer.dom(tb.root).querySelectorAll('.rows').length;
assert.equal(rowCount, 10, 'Default rows displayed should be 10 rows.');

table1Fixture.pageSize = 20;
flush(function(){
var newRowCount = Polymer.dom(tb.root).querySelectorAll('.rows').length;
assert.equal(newRowCount, 20, 'Default rows displayed should be 20 rows.');
done();
});
});
});
}

0 comments on commit 9822528

Please sign in to comment.