|
| 1 | +/* |
| 2 | + * Copyright 2014 The Polymer Authors. All rights reserved. |
| 3 | + * Use of this source code is goverened by a BSD-style |
| 4 | + * license that can be found in the LICENSE file. |
| 5 | + */ |
| 6 | + |
| 7 | +suite('HTMLTableElement', function() { |
| 8 | + |
| 9 | + test('instanceof', function() { |
| 10 | + var table = createTable(); |
| 11 | + assert.instanceOf(table, HTMLTableElement); |
| 12 | + }); |
| 13 | + |
| 14 | + test('caption', function() { |
| 15 | + var table = createTable(); |
| 16 | + assert.equal(table.caption.localName, 'caption'); |
| 17 | + }); |
| 18 | + |
| 19 | + test('createCaption', function() { |
| 20 | + var table = createTable(); |
| 21 | + var caption = table.createCaption(); |
| 22 | + assert.equal(caption.localName, 'caption'); |
| 23 | + assert.instanceOf(caption, HTMLElement); |
| 24 | + }); |
| 25 | + |
| 26 | + test('tHead', function() { |
| 27 | + var table = createTable(); |
| 28 | + assert.equal(table.tHead.localName, 'thead'); |
| 29 | + assert.instanceOf(table.tHead, HTMLTableSectionElement); |
| 30 | + }); |
| 31 | + |
| 32 | + test('createTHead', function() { |
| 33 | + var table = createTable(); |
| 34 | + var thead = table.createTHead(); |
| 35 | + assert.equal(thead.localName, 'thead'); |
| 36 | + assert.instanceOf(thead, HTMLTableSectionElement); |
| 37 | + }); |
| 38 | + |
| 39 | + test('tFoot', function() { |
| 40 | + var table = createTable(); |
| 41 | + assert.equal(table.tFoot.localName, 'tfoot'); |
| 42 | + assert.instanceOf(table.tFoot, HTMLTableSectionElement); |
| 43 | + }); |
| 44 | + |
| 45 | + test('createTFoot', function() { |
| 46 | + var table = createTable(); |
| 47 | + var tfoot = table.createTFoot(); |
| 48 | + assert.equal(tfoot.localName, 'tfoot'); |
| 49 | + assert.instanceOf(tfoot, HTMLTableSectionElement); |
| 50 | + }); |
| 51 | + |
| 52 | + test('tBodies', function() { |
| 53 | + var table = createTable(); |
| 54 | + assert.instanceOf(table.tBodies, HTMLCollection); |
| 55 | + assert.equal(table.tBodies.length, 2); |
| 56 | + |
| 57 | + assert.equal(table.tBodies[0], table.querySelector('tbody')); |
| 58 | + }); |
| 59 | + |
| 60 | + test('createTBody', function() { |
| 61 | + var table = createTable(); |
| 62 | + var tbody = table.createTBody(); |
| 63 | + assert.equal(tbody.localName, 'tbody'); |
| 64 | + assert.instanceOf(tbody, HTMLTableSectionElement); |
| 65 | + }); |
| 66 | + |
| 67 | + test('rows', function() { |
| 68 | + var table = createTable(); |
| 69 | + assert.instanceOf(table.rows, HTMLCollection); |
| 70 | + assert.equal(table.rows.length, 8); |
| 71 | + }); |
| 72 | + |
| 73 | + test('insertRow', function() { |
| 74 | + var table = createTable(); |
| 75 | + var tr = table.insertRow(1); |
| 76 | + assert.instanceOf(tr, HTMLTableRowElement); |
| 77 | + assert.equal(tr.localName, 'tr'); |
| 78 | + }); |
| 79 | + |
| 80 | +}); |
0 commit comments