Skip to content

Commit

Permalink
Test REPLConsole
Browse files Browse the repository at this point in the history
* REPLConsole#install()
* Close Action
  • Loading branch information
sh19910711 committed Jun 21, 2015
1 parent a05f96f commit 4ec707a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/templates/spec/repl_console_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
describe("REPLConsole", function() {
SpecHelper.prepareStageElement();

describe("#install()", function() {
beforeEach(function() {
this.elm = document.createElement("div");
this.stageElement.appendChild(this.elm);
});

context("install console", function() {
beforeEach(function() {
var replConsole = new REPLConsole;
replConsole.install(this.elm);
});
it("should have .console", function() {
assert.ok(hasClass(this.elm, "console"));
});
it("should have a inner", function() {
assert.equal(this.elm.getElementsByClassName("console-inner").length, 1);
});
it("should have a resizer", function() {
assert.equal(this.elm.getElementsByClassName("resizer").length, 1);
});
it("should have a close button", function() {
assert.equal(this.elm.getElementsByClassName("close-button").length, 1);
});
});
});

describe("console actions", function() {
describe("close action", function() {
beforeEach(function() {
this.elm = document.createElement("div");
this.elmId = this.elm.id = SpecHelper.randomString();
this.stageElement.appendChild(this.elm);
var replConsole = new REPLConsole;
replConsole.install(this.elm);
});

context("click close button", function() {
beforeEach(function() {
var closeButton = this.elm.getElementsByClassName("close-button")[0];
SpecHelper.triggerEvent(closeButton, "click");
});
it("should be removed from the parent node", function() {
assert.isNull(document.getElementById(this.elmId));
});
});
});
});
});

0 comments on commit 4ec707a

Please sign in to comment.