Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(ui): dont show till respecIsReady (closes #410)
- Loading branch information
1 parent
185c057
commit 32b8d54
Showing
7 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
function noOp() {} | ||
|
||
function getDisplay(elem){ | ||
// force layout; | ||
window.getComputedStyle(elem).width; // jshint ignore:line | ||
return window.getComputedStyle(elem).display; | ||
} | ||
|
||
describe("Core - Ui", function () { | ||
var ui; | ||
beforeAll(function (done) { | ||
require(["core/ui"], function (u) { | ||
ui = u; | ||
done(); | ||
}); | ||
}); | ||
|
||
afterAll(function (done) { | ||
flushIframes(); | ||
done(); | ||
}); | ||
|
||
it("shows and hides the UI", function (done) { | ||
makeRSDoc(makeStandardOps(), function (doc) { | ||
|
||
// Run with mock arguments | ||
ui.run({}, doc, noOp, { pub: noOp }); | ||
|
||
// We grab the second one, because it's the one generated by | ||
// calling "run" above. | ||
var pillContainer = doc.querySelectorAll("#respec-ui")[1]; | ||
|
||
// Show it | ||
ui.show(); | ||
var currentDisplay = getDisplay(pillContainer); | ||
expect(currentDisplay).toEqual("block"); | ||
|
||
// hide it | ||
ui.hide(); | ||
currentDisplay = getDisplay(pillContainer); | ||
expect(currentDisplay).toEqual("none"); | ||
|
||
// And show it again | ||
ui.show(); | ||
currentDisplay = getDisplay(pillContainer); | ||
expect(currentDisplay).toEqual("block"); | ||
}).then(done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters