Hrm... this works as long as I have no other specs. Here is the full
spec file am I missing something?
describe 'when a page with the file load health check initially
loads'
it 'should have the health check area not visible'
$('#HealthCheckArea').should.not.be_visible
end
it 'should have the green light already loaded'
$
('#HealthCheckArea').children('img').attr('src').should.include
'green_light.png'
end
end
describe 'when checking the health of the currently selected trade
date'
before_each
end
after_each
$.cookie($('#ExportDate').val(), null);
$.prompt.close();
end
describe 'and all files have loaded for the given date'
mock_request().and_return('{ "tradeDateIsValid" : true }',
'application/json')
$(document).fileLoadHealthCheck({
datePicker: '#ExportDate',
notificationArea: '#HealthCheckArea'
});
it 'should display the green light'
$
('#HealthCheckArea').children('img').attr('src').should.include
'green_light.png'
end
it 'should make the health check area visible'
$('#HealthCheckArea').should.be_visible
end
end
describe 'and all files have not loaded for the given date'
mock_request().and_return('{ "tradeDateIsValid" : false }',
'application/json')
$(document).fileLoadHealthCheck({
datePicker: '#ExportDate',
notificationArea: '#HealthCheckArea'
});
it 'should display the red light'
$
('#HealthCheckArea').children('img').attr('src').should.include
'red_light.png'
end
it 'should make the health check area visible'
$('#HealthCheckArea').should.be_visible
end
it 'should warn the user that the given date is incomplete'
$('#jqibox').should.be_visible
end
end
describe 'and the user has already been notified of an error for
the specific date'
mock_request().and_return('{ "tradeDateIsValid" : false }',
'application/json')
$.cookie($('#ExportDate').val(), "true");
$(document).fileLoadHealthCheck({
datePicker: '#ExportDate',
notificationArea: '#HealthCheckArea'
});
it 'should display the red light'
$
('#HealthCheckArea').children('img').attr('src').should.include
'red_light.png'
end
it 'should make the health check area visible'
$('#HealthCheckArea').should.be_visible
end
it 'should not warn the user'
$('#jqibox').should.be_empty
end
end
end
On May 12, 4:07 pm, Kevin Gisi <
ke...@kevingisi.com> wrote:
> $('#jqibox') will return a jQuery selector, even if it doesn't find
> anything, so it won't evaluate to null. However, the length of the object
> should be zero (meaning that jQuery did not match any elements).
>
> So substitute $('#jqibox').should.be_empty in, and you should be all set!
> :-)
>
> -Kevin W. Gisi
>
ke...@kevingisi.com |
(916) 538-4474http://www.kevingisi.com
> > unsubscribe:
jspec+un...@googlegroups.com<
jspec%2Bunsu...@googlegroups.com>