forked from assaf/zombie
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix firing the
change
event on SELECT tags when using jQuery.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "./helpers" | ||
{ vows: vows, assert: assert, zombie: zombie, brains: brains } = require("vows") | ||
jsdom = require("jsdom") | ||
|
||
brains.get "/jquery", (req, res)-> res.send """ | ||
<html> | ||
<head> | ||
<title>jQuery</title> | ||
<script src="/jquery.js"></script> | ||
</head> | ||
<body> | ||
<select> | ||
<option>None</option> | ||
<option value="1">One</option> | ||
</select> | ||
<span id="option"></span> | ||
</body> | ||
<script> | ||
$(function() { | ||
$("select").bind("change", function() { | ||
$("#option").text(this.value); | ||
}); | ||
}); | ||
</script> | ||
</html> | ||
""" | ||
|
||
vows.describe("Compatibility with JavaScript libraries").addBatch( | ||
"jQuery": | ||
zombie.wants "http://localhost:3003/jquery" | ||
"selecting an option in a select element": | ||
topic: (browser)-> | ||
browser.select "select", "1" | ||
@callback null, browser | ||
"should fire the change event": (browser)-> assert.equal browser.text("#option"), "1" | ||
|
||
|
||
).export(module) |
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