2017-06-07 13:57:49 +01:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
//
|
2018-01-05 10:42:49 +00:00
|
|
|
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
2017-06-07 13:57:49 +01:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
2017-06-12 16:51:54 +01:00
|
|
|
define([
|
|
|
|
|
'pgadmin',
|
|
|
|
|
'browser/menu',
|
|
|
|
|
], function (pgAdmin) {
|
|
|
|
|
describe('MenuItem', function () {
|
2017-06-07 13:57:49 +01:00
|
|
|
var MenuItem = pgAdmin.Browser.MenuItem;
|
|
|
|
|
var menuItem;
|
|
|
|
|
|
2017-06-12 16:55:14 +01:00
|
|
|
describe('when we create a menu item', function () {
|
2017-06-07 13:57:49 +01:00
|
|
|
describe('and it is disabled', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
menuItem = new MenuItem({enable: false, icon: 'fa fa-car'});
|
|
|
|
|
menuItem.create_el({}, {});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change the text color to gray', function () {
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-gray-4')).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('when becomes enabled', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
menuItem.enable = true;
|
|
|
|
|
menuItem.update({},{});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change the text color to white', function () {
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-gray-4')).toBeFalsy();
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-white')).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('and it is enabled', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
menuItem = new MenuItem({enable: true, icon: 'fa fa-car'});
|
|
|
|
|
menuItem.create_el({}, {});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change the text color to white', function () {
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-white')).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('when becomes disabled', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
menuItem.enable = false;
|
|
|
|
|
menuItem.update({},{});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should change the text color to gray', function () {
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-gray-4')).toBeTruthy();
|
|
|
|
|
expect(menuItem.$el.find('span').hasClass('font-white')).toBeFalsy();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|