-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
7 changed files
with
78 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var hashTester = require('hsp/utils/hashtester'); | ||
var messageSample = require('./clickhandler.hsp'); | ||
|
||
describe('"Simple event handler" sample', function () { | ||
|
||
var h; | ||
beforeEach(function () { | ||
h = hashTester.newTestContext(); | ||
messageSample.message(messageSample.msg).render(h.container); | ||
}); | ||
|
||
afterEach(function () { | ||
h.$dispose(); | ||
}); | ||
|
||
it('should render initial state', function () { | ||
expect(h('div').text()).to.equal('Click me to discover hashspace event handlers'); | ||
}); | ||
|
||
it('should cycle through messages on click', function () { | ||
h('div').click(); | ||
expect(h('div > span').text()).to | ||
.equal('Well done - you called the event handler and updated the data model in a row!'); | ||
|
||
h('div').click(); | ||
expect(h('div > span.warning').text()).to.match(/WARNING/); | ||
expect(h('div > span:eq(1)').text()).to.equal('If you click again you will be back to first step!'); | ||
|
||
h('div').click(); | ||
expect(h('div > span').text()).to.equal('Click me to discover hashspace event handlers'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
# template hello(name) | ||
# export template hello(name) | ||
<div class="msg"> | ||
Hello {name}! | ||
</div> | ||
# /template | ||
|
||
// display the template in the #output div | ||
hello("World").render("output"); | ||
hello("World").render("output"); |
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,19 @@ | ||
var hashTester = require('hsp/utils/hashtester'); | ||
var helloTpl = require('./hello.hsp').hello; | ||
|
||
describe('"Hello World" sample', function () { | ||
|
||
var h; | ||
beforeEach(function () { | ||
h = hashTester.newTestContext(); | ||
}); | ||
|
||
afterEach(function () { | ||
h.$dispose(); | ||
}); | ||
|
||
it('should render "Hello World" from a template', function () { | ||
helloTpl('World').render(h.container); | ||
expect(h('div.msg').text()).to.equal('Hello World!'); | ||
}); | ||
}); |
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