added rte and assets service mocks

This commit is contained in:
perploug
2013-11-28 12:29:58 +01:00
parent 7f305db637
commit e076b687c6
4 changed files with 68 additions and 10 deletions

View File

@@ -0,0 +1,23 @@
describe('RTE controller tests', function () {
var scope, controllerFactory;
beforeEach(module('umbraco'));
beforeEach(inject(function ($rootScope, $controller) {
controllerFactory = $controller;
scope = $rootScope.$new();
scope.model = {value: "<p>hello</p>"};
}));
describe('initialization', function () {
it('should define the default properties on construction', function () {
controllerFactory('Umbraco.PropertyEditors.RTEController', {
$scope: scope,
$routeParams: routeParams
});
});
});
});

View File

@@ -1,23 +1,33 @@
describe('keyboard service tests', function () {
describe('Assets service tests', function () {
var assetsService, $window, $rootScope;
beforeEach(module('umbraco.services'));
beforeEach(module('umbraco.mocks.services'));
beforeEach(inject(function ($injector) {
assetsService = $injector.get('assetsService');
$window = $injector.get("$window");
$rootScope = $injector.get('$rootScope');
}));
afterEach(inject(function($rootScope) {
$rootScope.$apply();
}));
describe('Loading js assets', function () {
it('Loads a javascript file', function () {
assetsService.loadJs("base/lib/umbraco/NamespaceManager.js").then(function(){
console.log("loaded");
});
//this currently doesnt work, the test server returns 404
$rootScope.$digest();
});
var loaded = false;
runs( function(){
assetsService.loadJs("lib/umbraco/NamespaceManager.js").then(function(){
console.log( "done" );
expect(Umbraco.Sys).toNotBe(undefined);
});
});
runs(function(){
console.log( "asserting" );
expect(Umbraco.Sys).toNotBe(undefined);
});
});
});
});