Skip to content

Commit

Permalink
add clicked method
Browse files Browse the repository at this point in the history
  • Loading branch information
apeckham committed Aug 25, 2010
1 parent 13fea15 commit 592ad68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -5,6 +5,7 @@ end
task :default do
ZendeskUpdater.update_widget(193100, html_for('admin'))
ZendeskUpdater.update_widget(197779, html_for('map'))
ZendeskUpdater.update_widget(199606, html_for('random'))
ZendeskUpdater.update_widget(193142, all_html)
end

Expand Down
7 changes: 6 additions & 1 deletion javascript/random.js
Expand Up @@ -4,7 +4,12 @@ Urban.Random = Class.create({
initialize: function(element) {
var anchor = new Element("a");
anchor.update("Random ticket");
anchor.observe('click', this.clicked.bind(this));

element.update(anchor)
element.update(anchor);
},

clicked: function() {
window.blah = 100;
}
});
5 changes: 5 additions & 0 deletions spec/RandomSpec.js
Expand Up @@ -10,4 +10,9 @@ describe("Random widget", function() {
new Urban.Random(element);
expect(element.down("a")).toBeTruthy();
});

it("should do something when you click on the link", function() {
new Urban.Random(element).clicked();
expect(window.blah).toEqual(100);
});
});

0 comments on commit 592ad68

Please sign in to comment.