Closed tsujigiri closed 9 years ago
I'm currently trying to set up teaspoon with a Rails app and am stuck with a click event, that doesn't seem to get fired. I created a fixture:
%div = check_box_tag 'check_all', 1, true = check_box_tag 'other_checkbox', 1, true
This is the code I try to test:
$ -> console.log("Ready!") $('#check_all').click (e) -> console.log("Click!") checked = $(e.target).is(':checked') $('input[type="checkbox"]').prop('checked', checked)
My spec looks like this;
#= require check_all describe 'check-all checkbox', -> fixture.load('check_all.html') it 'checks all checkboxes', -> check_all = fixture.$el.find('#check_all') other_checkbox = fixture.$el.find('#other_checkbox') expect(check_all.is(':checked')).toBe(true) expect(other_checkbox.is(':checked')).toBe(true) check_all.click() expect(check_all.is(':checked')).toBe(false) expect(other_checkbox.is(':checked')).toBe(false)
In the terminal I see the Ready! message, but the Click! message doesn't show up and the last expectation fails.
Am I doing this wrong? :)
I'm currently trying to set up teaspoon with a Rails app and am stuck with a click event, that doesn't seem to get fired. I created a fixture:
This is the code I try to test:
My spec looks like this;
In the terminal I see the Ready! message, but the Click! message doesn't show up and the last expectation fails.
Am I doing this wrong? :)