Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Grids remember their visibility on resize

Module object now has a visible boolean property that is tracked. This can
be set manually if someone wished to start the grid in a hidden state.
Added tests for this feature.
  • Loading branch information...
commit 426e4f148ccccf2c4cff14a0e30d94bdaa929008 1 parent 8506b4a
@conzett authored
Showing with 13 additions and 1 deletion.
  1. +4 −1 grid-checker.js
  2. +9 −0 tests/tests.js
View
5 grid-checker.js
@@ -23,7 +23,8 @@ gridChecker = function (Grids, Target) {
width : 102px,
height : 100%,
margin : "0 3px",
- color : #336699
+ color : #336699,
+ visible : true
*/
var container,
@@ -55,6 +56,7 @@ gridChecker = function (Grids, Target) {
if (grid !== null) {
grid.style.display = (grid.style.display === 'none') ? 'block' : 'none';
}
+ gridsArg[ID - 1].visible = false;
};
parseMargin = function (Margin) {
@@ -91,6 +93,7 @@ gridChecker = function (Grids, Target) {
container = document.createElement('div');
container.setAttribute('id', 'gc-grid-' + Index);
container.setAttribute('style', innerContainerStyle);
+ container.style.display = (Module.visible === false) ? 'none' : 'block';
style = 'margin: ' + m[0] + " " + m[1] + " " + m[2] + " " + m[3] + ' !important;';
style += 'background-color: ' + moduleColor + ' !important;';
View
9 tests/tests.js
@@ -121,4 +121,13 @@ test("Toggle the grids when the appropriate button is clicked.", function () {
ok((grid.style.display === 'none'), "After clicking the button expect it to be hidden");
button.click();
ok((grid.style.display !== 'none'), "Back to being visible again");
+});
+
+test("Grids can be specified visible or hidden on creation.", function () {
+ 'use strict';
+ var grid,
+ module1 = { width : "102px", margin : "3px", height : "90px", visible : false};
+ gridChecker([module1], fixtureID);
+ grid = document.getElementById(gridID);
+ ok((grid.style.display === 'none'), "Expect the grid to be initially hidden");
});
Please sign in to comment.
Something went wrong with that request. Please try again.