2017-06-30 09:23:12 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2018-01-05 10:42:49 +00:00
|
|
|
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
2017-06-30 09:23:12 +00:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2017-07-31 13:29:44 +00:00
|
|
|
import alertify from 'pgadmin.alertifyjs';
|
2017-06-30 09:23:12 +00:00
|
|
|
|
|
|
|
describe('alertify_wrapper', function () {
|
|
|
|
describe('success', function () {
|
|
|
|
it('calls the success function from alertify and adds the checkmark to the element', function () {
|
2017-07-31 13:29:44 +00:00
|
|
|
spyOn(alertify, 'orig_success');
|
2017-06-30 09:23:12 +00:00
|
|
|
|
2017-07-31 13:29:44 +00:00
|
|
|
alertify.success('Yay, congrats!', 1);
|
2017-06-30 09:23:12 +00:00
|
|
|
|
2017-07-31 13:29:44 +00:00
|
|
|
var calledWithMessage = alertify.orig_success.calls.mostRecent().args[0];
|
2017-06-30 09:23:12 +00:00
|
|
|
|
|
|
|
expect(calledWithMessage).toContain('Yay, congrats!');
|
|
|
|
expect(calledWithMessage).toContain('class="fa fa-check"');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('error', function () {
|
|
|
|
it('calls the error function from alertify and adds the warning symbol to the element', function () {
|
2017-07-31 13:29:44 +00:00
|
|
|
spyOn(alertify, 'orig_error');
|
2017-06-30 09:23:12 +00:00
|
|
|
|
2017-07-31 13:29:44 +00:00
|
|
|
alertify.error('bad, very bad', 1);
|
2017-06-30 09:23:12 +00:00
|
|
|
|
2017-07-31 13:29:44 +00:00
|
|
|
var calledWithMessage = alertify.orig_error.calls.mostRecent().args[0];
|
2017-06-30 09:23:12 +00:00
|
|
|
|
|
|
|
expect(calledWithMessage).toContain('bad, very bad');
|
|
|
|
expect(calledWithMessage).toContain('class="fa fa-exclamation-triangle"');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|