delete fontawesome
This commit is contained in:
@@ -1,89 +1,89 @@
|
||||
describe('Drop down controller tests', function () {
|
||||
var scope, controllerFactory;
|
||||
|
||||
beforeEach(module('umbraco'));
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller) {
|
||||
|
||||
controllerFactory = $controller;
|
||||
scope = $rootScope.$new();
|
||||
scope.model = {};
|
||||
}));
|
||||
|
||||
describe('initialization', function () {
|
||||
|
||||
it('should define the default properties on construction', function () {
|
||||
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
|
||||
expect(scope.model.config).toBeDefined();
|
||||
expect(scope.model.config.items).toBeDefined();
|
||||
expect(scope.model.config.multiple).toBeDefined();
|
||||
});
|
||||
|
||||
it("should convert simple array to dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: ["value0", "value1", "value2"]
|
||||
}
|
||||
};
|
||||
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
|
||||
expect(scope.model.config.items["value0"]).toBe("value0");
|
||||
expect(scope.model.config.items["value1"]).toBe("value1");
|
||||
expect(scope.model.config.items["value2"]).toBe("value2");
|
||||
|
||||
});
|
||||
|
||||
it("should allow an existing valid dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: {
|
||||
"value0" : "Value 0",
|
||||
"value1" : "Value 1",
|
||||
"value2" : "Value 2"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var test = function() {
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
};
|
||||
|
||||
expect(test).not.toThrow();
|
||||
|
||||
});
|
||||
|
||||
it("should not allow a non-array or non-dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: true
|
||||
}
|
||||
};
|
||||
|
||||
var test = function () {
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
};
|
||||
|
||||
expect(test).toThrow();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
describe('Drop down controller tests', function () {
|
||||
var scope, controllerFactory;
|
||||
|
||||
beforeEach(module('umbraco'));
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller) {
|
||||
|
||||
controllerFactory = $controller;
|
||||
scope = $rootScope.$new();
|
||||
scope.model = {};
|
||||
}));
|
||||
|
||||
describe('initialization', function () {
|
||||
|
||||
it('should define the default properties on construction', function () {
|
||||
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
|
||||
expect(scope.model.config).toBeDefined();
|
||||
expect(scope.model.config.items).toBeDefined();
|
||||
expect(scope.model.config.multiple).toBeDefined();
|
||||
});
|
||||
|
||||
it("should convert simple array to dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: ["value0", "value1", "value2"]
|
||||
}
|
||||
};
|
||||
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
|
||||
expect(scope.model.config.items["value0"]).toBe("value0");
|
||||
expect(scope.model.config.items["value1"]).toBe("value1");
|
||||
expect(scope.model.config.items["value2"]).toBe("value2");
|
||||
|
||||
});
|
||||
|
||||
it("should allow an existing valid dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: {
|
||||
"value0" : "Value 0",
|
||||
"value1" : "Value 1",
|
||||
"value2" : "Value 2"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var test = function() {
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
};
|
||||
|
||||
expect(test).not.toThrow();
|
||||
|
||||
});
|
||||
|
||||
it("should not allow a non-array or non-dictionary", function () {
|
||||
|
||||
scope.model = {
|
||||
config: {
|
||||
items: true
|
||||
}
|
||||
};
|
||||
|
||||
var test = function () {
|
||||
controllerFactory('Umbraco.Editors.DropdownController', {
|
||||
$scope: scope,
|
||||
$routeParams: routeParams
|
||||
});
|
||||
};
|
||||
|
||||
expect(test).toThrow();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,25 +1,25 @@
|
||||
describe('keyboard service tests', function () {
|
||||
var assetsService, $window, $rootScope;
|
||||
beforeEach(module('umbraco.services'));
|
||||
beforeEach(inject(function ($injector) {
|
||||
assetsService = $injector.get('assetsService');
|
||||
$window = $injector.get("$window");
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
}));
|
||||
|
||||
|
||||
|
||||
describe('Loading js assets', function () {
|
||||
|
||||
it('Loads a javascript file', function () {
|
||||
assetsService.loadJs("NamespaceManager.js").then(function(){
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
//this currently doesnt work, the test server returns 404
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
describe('keyboard service tests', function () {
|
||||
var assetsService, $window, $rootScope;
|
||||
beforeEach(module('umbraco.services'));
|
||||
beforeEach(inject(function ($injector) {
|
||||
assetsService = $injector.get('assetsService');
|
||||
$window = $injector.get("$window");
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
}));
|
||||
|
||||
|
||||
|
||||
describe('Loading js assets', function () {
|
||||
|
||||
it('Loads a javascript file', function () {
|
||||
assetsService.loadJs("NamespaceManager.js").then(function(){
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
//this currently doesnt work, the test server returns 404
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,33 +1,33 @@
|
||||
describe('file manager tests', function () {
|
||||
var fileManager;
|
||||
|
||||
beforeEach(module('umbraco.services'));
|
||||
|
||||
beforeEach(inject(function ($injector) {
|
||||
fileManager = $injector.get('fileManager');
|
||||
}));
|
||||
|
||||
describe('file management', function () {
|
||||
|
||||
it('adding a file adds to the collection', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
expect(fileManager.getFiles().length).toBe(1);
|
||||
});
|
||||
|
||||
it('adding a file with the same property id replaces the existing one', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
fileManager.setFiles(123, ["testFile2"]);
|
||||
expect(fileManager.getFiles().length).toBe(1);
|
||||
expect(fileManager.getFiles()[0].file).toBe("testFile2");
|
||||
});
|
||||
|
||||
it('clears all files', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
fileManager.setFiles(234, ["testFile"]);
|
||||
expect(fileManager.getFiles().length).toBe(2);
|
||||
fileManager.clearFiles();
|
||||
expect(fileManager.getFiles().length).toBe(0);
|
||||
});
|
||||
|
||||
});
|
||||
describe('file manager tests', function () {
|
||||
var fileManager;
|
||||
|
||||
beforeEach(module('umbraco.services'));
|
||||
|
||||
beforeEach(inject(function ($injector) {
|
||||
fileManager = $injector.get('fileManager');
|
||||
}));
|
||||
|
||||
describe('file management', function () {
|
||||
|
||||
it('adding a file adds to the collection', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
expect(fileManager.getFiles().length).toBe(1);
|
||||
});
|
||||
|
||||
it('adding a file with the same property id replaces the existing one', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
fileManager.setFiles(123, ["testFile2"]);
|
||||
expect(fileManager.getFiles().length).toBe(1);
|
||||
expect(fileManager.getFiles()[0].file).toBe("testFile2");
|
||||
});
|
||||
|
||||
it('clears all files', function () {
|
||||
fileManager.setFiles(123, ["testFile"]);
|
||||
fileManager.setFiles(234, ["testFile"]);
|
||||
expect(fileManager.getFiles().length).toBe(2);
|
||||
fileManager.clearFiles();
|
||||
expect(fileManager.getFiles().length).toBe(0);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,51 +1,51 @@
|
||||
describe('keyboard service tests', function () {
|
||||
var keyboardService, $window, $rootScope;
|
||||
|
||||
var createKeyEvent = function (mainKey, alt, ctrl, shift, meta) {
|
||||
var keyEvent = jQuery.Event("keypress");
|
||||
keyEvent.keyCode = mainKey.charCodeAt(0);
|
||||
keyEvent.altKey = alt;
|
||||
keyEvent.ctrlKey = ctrl;
|
||||
keyEvent.shiftKey = shift;
|
||||
keyEvent.metaKey = meta;
|
||||
return keyEvent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
beforeEach(module('umbraco.services'));
|
||||
beforeEach(inject(function ($injector) {
|
||||
keyboardService = $injector.get('keyboardService');
|
||||
$window = $injector.get("$window");
|
||||
$rootScope = $injector.get("$rootScope");
|
||||
}));
|
||||
|
||||
|
||||
describe('Detecting key combinations', function () {
|
||||
|
||||
it('Detects ctrl+s', function () {
|
||||
|
||||
var ctrls = false;
|
||||
var el = $("<span></span>");
|
||||
var ev = createKeyEvent("s", false, false, false);
|
||||
keyboardService.bind("s", function(){
|
||||
ctrls = true;
|
||||
});
|
||||
|
||||
//initially it should be false
|
||||
expect(ctrls).toBe(false);
|
||||
|
||||
//trigger the ctrls+s event
|
||||
//triggerEvent(el, "s", true);
|
||||
el.trigger(ev);
|
||||
|
||||
$rootScope.$digest();
|
||||
|
||||
//it should now be true - this fails for some reason
|
||||
//we will investigate some other time
|
||||
// expect(ctrls).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
describe('keyboard service tests', function () {
|
||||
var keyboardService, $window, $rootScope;
|
||||
|
||||
var createKeyEvent = function (mainKey, alt, ctrl, shift, meta) {
|
||||
var keyEvent = jQuery.Event("keypress");
|
||||
keyEvent.keyCode = mainKey.charCodeAt(0);
|
||||
keyEvent.altKey = alt;
|
||||
keyEvent.ctrlKey = ctrl;
|
||||
keyEvent.shiftKey = shift;
|
||||
keyEvent.metaKey = meta;
|
||||
return keyEvent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
beforeEach(module('umbraco.services'));
|
||||
beforeEach(inject(function ($injector) {
|
||||
keyboardService = $injector.get('keyboardService');
|
||||
$window = $injector.get("$window");
|
||||
$rootScope = $injector.get("$rootScope");
|
||||
}));
|
||||
|
||||
|
||||
describe('Detecting key combinations', function () {
|
||||
|
||||
it('Detects ctrl+s', function () {
|
||||
|
||||
var ctrls = false;
|
||||
var el = $("<span></span>");
|
||||
var ev = createKeyEvent("s", false, false, false);
|
||||
keyboardService.bind("s", function(){
|
||||
ctrls = true;
|
||||
});
|
||||
|
||||
//initially it should be false
|
||||
expect(ctrls).toBe(false);
|
||||
|
||||
//trigger the ctrls+s event
|
||||
//triggerEvent(el, "s", true);
|
||||
el.trigger(ev);
|
||||
|
||||
$rootScope.$digest();
|
||||
|
||||
//it should now be true - this fails for some reason
|
||||
//we will investigate some other time
|
||||
// expect(ctrls).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user