Fixes login and tree

Adds tree loader, fixes icons, fixes toggle arrows
Refactors httpbackend into nicer system
Testing of promises are broken :(
TODO: update docs
This commit is contained in:
Per Ploug
2013-07-01 16:06:41 +02:00
parent 0d44189f7f
commit 2b13dff769
41 changed files with 12450 additions and 18976 deletions

View File

@@ -9,14 +9,15 @@ module.exports = function(karma) {
files: [
'lib/jquery/jquery-1.8.2.min.js',
'lib/angular/angular.min.js',
'lib/underscore/underscore.js',
'test/lib/angular/angular-mocks.js',
'src/app.js',
'src/app_dev.js',
'src/common/directives/*.js',
'src/common/filters/*.js',
'src/common/services/*.js',
'src/common/security/*.js',
'src/common/mocks/*.js',
'src/common/resources/*.js',
'src/common/mocks/**/*.js',
'src/views/**/*.controller.js',
'test/unit/**/*.spec.js'
],
@@ -44,7 +45,7 @@ module.exports = function(karma) {
// level of logging
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
// CLI --log-level debug
logLevel: karma.LOG_INFO,
logLevel: karma.LOG_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
// CLI --auto-watch --no-auto-watch

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +1,42 @@
describe('content factory tests', function () {
var $scope, contentFactory;
var $rootScope, $httpBackend, contentFactory;
beforeEach(module('umbraco.services'));
beforeEach(module('umbraco.resources'));
beforeEach(module('umbraco.httpbackend'));
beforeEach(inject(function($injector) {
$scope = $injector.get('$rootScope');
contentFactory = $injector.get('contentResource');
beforeEach(inject(function ($injector) {
$rootScope = $injector.get('$rootScope');
$httpBackend = $injector.get('$httpBackend');
contentFactory = $injector.get('contentResource');
}));
describe('global content factory crud', function () {
afterEach(function () {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('should return a content object, given an id', function () {
var doc1 = contentFactory.getById(1234).then(function(doc1){
expect(doc1).toNotBe(undefined);
expect(doc1.id).toBe(1234);
});
describe('global content factory crud', function () {
it('should return a content object, given an id', function () {
var doc = "meh";
contentFactory.getById(1234).then(function (result) {
doc = result;
});
console.log("doc:", doc);
$rootScope.$root.$digest();
//$scope.$apply();
//.then(function (doc1) {
console.log("doc:", doc);
expect(doc).toNotBe(undefined);
expect(doc.id).toBe(1234);
//});
});
it('should return a content children collection given an id', function () {

View File

@@ -1,30 +1,34 @@
describe('content type factory tests', function () {
var $scope, contentTypeFactory;
var $rootScope, contentTypeResource;
beforeEach(module('umbraco.services'));
beforeEach(module('umbraco.resources'));
beforeEach(inject(function($injector) {
$scope = $injector.get('$rootScope');
contentTypeFactory = $injector.get('contentTypeResource');
beforeEach(module('umbraco.httpbackend'));
beforeEach(inject(function ($injector) {
$rootScope = $injector.get('$rootScope');
contentTypeResource = $injector.get('contentTypeResource');
}));
describe('global content type factory crud', function () {
it('should return a content type object, given an id', function () {
var ct1 = contentTypeFactory.getContentType(1234);
var ct1 = contentTypeResource.getContentType(1234);
$rootScope.$digest();
console.log("ct1:", ct1);
expect(ct1).toNotBe(undefined);
expect(ct1.id).toBe(1234);
});
it('should return a allowed content type collection given a document id', function () {
var collection = contentTypeFactory.getAllowedTypes(1234);
console.log("running test", angular.toJson(collection));
it('should return a allowed content type collection given a document id', function(){
// var collection = contentTypeResource.getAllowedTypes(1234);
// $rootScope.$apply();
//expect(collection.length).toBe(3);
// console.log("running test", angular.toJson(collection));
// expect(collection.length).toBe(3);
});
});
});