forked from gsamokovarov/web-console
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cc76ad
commit 2be719d
Showing
9 changed files
with
143 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ matrix: | |
- env: TEST_SUITE=test:templates | ||
include: | ||
- env: TEST_SUITE=test:templates | ||
rvm: 2.2 | ||
rvm: 2.2.5 |
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ def call(env) | |
end | ||
|
||
def view | ||
@view ||= View.new(@view_path) | ||
@view = View.new(@view_path) | ||
end | ||
|
||
private | ||
|
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,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Templates Test</title> | ||
<link rel="stylesheet" href="/node_modules/mocha/mocha.css" /> | ||
</head> | ||
<body> | ||
<!-- setup for mocha --> | ||
<div id="mocha"></div> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script> | ||
mocha.setup('tdd'); | ||
mocha.reporter('html'); | ||
</script> | ||
|
||
<!-- load templates --> | ||
<script src="/templates/console.js"></script> | ||
|
||
<!-- find and load test cases --> | ||
<script src="/spec/spec_helper.js"></script> | ||
<% Pathname.glob(TEST_ROOT.join "test/**/*_test.js") do |t| %> | ||
<script src="/<%= t.relative_path_from TEST_ROOT %>"></script> | ||
<% end %> | ||
|
||
<!-- run tests --> | ||
<script> | ||
if (window.mochaPhantomJS) { | ||
mochaPhantomJS.run(); | ||
} else { | ||
mocha.run(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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,37 @@ | ||
describe("Auto Complete", function() { | ||
beforeEach(function() { | ||
var self = this.autoComplete = new Autocomplete(["something", "somewhat", "somewhere"], 'some'); | ||
this.moveNext = function(times) { | ||
for (var i = 0; i < times; ++i) self.next(); | ||
}; | ||
this.assertSelect = function(pos) { | ||
assert.equal(self.current, pos); | ||
}; | ||
}); | ||
describe("move functions", function() { | ||
context("set up with three elements", function() { | ||
it("should have three elements", function() { | ||
assert.ok(this.autoComplete.view.children.length === 3) | ||
}); | ||
it("should have no selected element", function() { | ||
assert.ok(this.autoComplete.view.getElementsByClassName('selected').length === 0); | ||
}); | ||
context("move next two times", function() { | ||
beforeEach(function() { this.moveNext(2) }); | ||
it("should point the 1-th element", function() { this.assertSelect(1); }); | ||
context("back once", function() { | ||
beforeEach(function() { this.autoComplete.back(); }); | ||
it("should point the 0-th element", function() { this.assertSelect(0); }); | ||
context("back once again", function() { | ||
beforeEach(function() { this.autoComplete.back(); }); | ||
it("should point the last element", function() { this.assertSelect(2); }); | ||
}); | ||
}); | ||
context("move next two times again", function() { | ||
beforeEach(function() { this.moveNext(2) }); | ||
it("should back to the first of list", function() { this.assertSelect(0); }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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