Add tests to correct location
This commit is contained in:
@@ -46,5 +46,16 @@ define(['jquery', 'js/discovery/views/search_form'], function($, SearchForm) {
|
||||
this.form.showErrorMessage();
|
||||
expect($('#discovery-message')).not.toBeEmpty();
|
||||
});
|
||||
|
||||
it('shows default error message', function() {
|
||||
this.form.showErrorMessage();
|
||||
expect(this.form.$message).toContainHtml('There was an error, try searching again.');
|
||||
});
|
||||
|
||||
it('shows remote error message', function() {
|
||||
let remoteError = 'some-error-message';
|
||||
this.form.showErrorMessage(remoteError);
|
||||
expect(this.form.$message).toContainHtml(remoteError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -299,16 +299,6 @@ define([
|
||||
expect($('.cancel-button')).toBeVisible();
|
||||
}
|
||||
|
||||
function showDefaultErrorMessage() {
|
||||
this.form.showErrorMessage();
|
||||
expect(this.form.$message).toContainHtml('There was an error, try searching again.');
|
||||
}
|
||||
|
||||
function showRemoteErrorMessage() {
|
||||
this.form.showErrorMessage('some-error-message');
|
||||
expect(this.form.$message).toContainHtml('some-error-message');
|
||||
}
|
||||
|
||||
function triggersSearchEvent() {
|
||||
var term = 'search string';
|
||||
$('.search-field').val(term);
|
||||
@@ -351,8 +341,6 @@ define([
|
||||
});
|
||||
it('trims input string', trimsInputString);
|
||||
it('handles calls to doSearch', doesSearch);
|
||||
it('displays default message on error', showDefaultErrorMessage);
|
||||
it('displays provided message on error', showRemoteErrorMessage);
|
||||
it('triggers a search event and changes to active state', triggersSearchEvent);
|
||||
it('clears search when clicking on cancel button', clearsSearchOnCancel);
|
||||
it('clears search when search box is empty', clearsSearchOnEmpty);
|
||||
|
||||
Reference in New Issue
Block a user