diff options
author | James Graham <james@hoppipolla.co.uk> | 2015-07-27 17:47:31 +0100 |
---|---|---|
committer | James Graham <james@hoppipolla.co.uk> | 2015-07-27 17:47:31 +0100 |
commit | df03062d626f485dd896ce9c4374dfce447dc657 (patch) | |
tree | a96bdde06c6cd88dd68bc5ef4de8277fc6250a60 /tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js | |
parent | 662c00a8109c49d4c57343156b774441f4f48640 (diff) | |
download | servo-df03062d626f485dd896ce9c4374dfce447dc657.tar.gz servo-df03062d626f485dd896ce9c4374dfce447dc657.zip |
Update CSS tests to revision 2baa72daab8bf37e3e910a9fd311a1eaa5b0f4a8
Diffstat (limited to 'tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js')
-rw-r--r-- | tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js b/tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js new file mode 100644 index 00000000000..c4ceec3a805 --- /dev/null +++ b/tests/wpt/css-tests/css-grid-1_dev/html/support/testing-utils.js @@ -0,0 +1,33 @@ +var TestingUtils = (function() { + + function checkGridTemplateColumns(element, value) { + assert_in_array(getComputedStyle(element).gridTemplateColumns, value, "gridTemplateColumns"); + } + + function checkGridTemplateRows(element, value) { + assert_in_array(getComputedStyle(element).gridTemplateRows, value, "gridTemplateRows"); + } + + function testGridTemplateColumnsRows(gridId, columnsStyle, rowsStyle, columnsComputedValue, rowsComputedValue) { + test(function() { + var grid = document.getElementById(gridId); + grid.style.gridTemplateColumns = columnsStyle; + grid.style.gridTemplateRows = rowsStyle; + checkGridTemplateColumns(grid, columnsComputedValue); + checkGridTemplateRows(grid, rowsComputedValue); + }, "'" + gridId + "' with: grid-template-columns: " + columnsStyle + "; and grid-template-rows: " + rowsStyle + ";"); + } + + function testGridTemplateAreas(gridId, style, value) { + test(function() { + var grid = document.getElementById(gridId); + grid.style.gridTemplateAreas = style; + assert_equals(getComputedStyle(grid).gridTemplateAreas, value, "gridTemplateAreas"); + }, "'" + gridId + "' with: grid-template-areas: " + style + ";"); + } + + return { + testGridTemplateColumnsRows: testGridTemplateColumnsRows, + testGridTemplateAreas: testGridTemplateAreas + } +})(); |