Working tree mock data
This commit is contained in:
@@ -2,6 +2,24 @@ angular.module('umbraco.mocks').
|
||||
factory('contentMocks', ['$httpBackend', 'mocksUtills', function ($httpBackend, mocksUtills) {
|
||||
'use strict';
|
||||
|
||||
function returnEmptyNode(status, data, headers) {
|
||||
var response = returnNodebyId(200, "", null);
|
||||
var node = response[1];
|
||||
var parentId = mocksUtills.getParameterByName(data, "parentId") || 1234;
|
||||
|
||||
node.name = "";
|
||||
node.id = 0;
|
||||
node.parentId = parentId;
|
||||
|
||||
$(node.tabs).each(function(i,tab){
|
||||
$(tab.properties).each(function(i, property){
|
||||
property.value = "";
|
||||
});
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
function returnNodebyId(status, data, headers) {
|
||||
var id = mocksUtills.getParameterByName(data, "id") || 1234;
|
||||
|
||||
@@ -83,7 +101,15 @@ angular.module('umbraco.mocks').
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Content/GetById'))
|
||||
.respond(returnNodebyId);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Content/GetEmpty'))
|
||||
.respond(returnEmptyNode);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
expectGetById: function() {
|
||||
$httpBackend
|
||||
.expectGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Content/GetById'));
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
angular.module('umbraco.mocks').
|
||||
factory('mediaMocks', ['$httpBackend', 'mocksUtills', function ($httpBackend, mocksUtills) {
|
||||
'use strict';
|
||||
|
||||
function returnNodebyId(status, data, headers) {
|
||||
var id = mocksUtills.getParameterByName(data, "id") || 1234;
|
||||
|
||||
var node = {
|
||||
name: "My content with id: " + id,
|
||||
updateDate: new Date(),
|
||||
publishDate: new Date(),
|
||||
id: id,
|
||||
parentId: 1234,
|
||||
icon: "icon-file-alt",
|
||||
owner: {name: "Administrator", id: 0},
|
||||
updater: {name: "Per Ploug Krogslund", id: 1},
|
||||
|
||||
tabs: [
|
||||
{
|
||||
label: "Child documents",
|
||||
alias: "tab00",
|
||||
id: 0,
|
||||
active: true,
|
||||
properties: [
|
||||
{ alias: "list", label: "List", view: "listview", value: "", hideLabel: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Content",
|
||||
alias: "tab01",
|
||||
id: 1,
|
||||
properties: [
|
||||
{ alias: "bodyText", label: "Body Text", description:"Here you enter the primary article contents", view: "rte", value: "<p>askjdkasj lasjd</p>" },
|
||||
{ alias: "textarea", label: "textarea", view: "textarea", value: "ajsdka sdjkds", config: { rows: 4 } },
|
||||
{ alias: "map", label: "Map", view: "googlemaps", value: "37.4419,-122.1419", config: { mapType: "ROADMAP", zoom: 4 } },
|
||||
{ alias: "media", label: "Media picker", view: "mediapicker", value: "" },
|
||||
{ alias: "content", label: "Content picker", view: "contentpicker", value: "" }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Sample Editor",
|
||||
alias: "tab02",
|
||||
id: 2,
|
||||
properties: [
|
||||
{ alias: "datepicker", label: "Datepicker", view: "datepicker", config: { rows: 7 } },
|
||||
{ alias: "tags", label: "Tags", view: "tags", value: ""}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Grid",
|
||||
alias: "tab03",
|
||||
id: 3,
|
||||
properties: [
|
||||
{ alias: "grid", label: "Grid", view: "grid", controller: "umbraco.grid", value: "test", hideLabel: true }
|
||||
]
|
||||
},{
|
||||
label: "WIP",
|
||||
alias: "tab04",
|
||||
id: 4,
|
||||
properties: [
|
||||
{ alias: "tes", label: "Stuff", view: "test", controller: "umbraco.embeddedcontent", value: "",
|
||||
|
||||
config: {
|
||||
fields: [
|
||||
{ alias: "embedded", label: "Embbeded", view: "textstring", value: ""},
|
||||
{ alias: "embedded2", label: "Embbeded 2", view: "contentpicker", value: ""},
|
||||
{ alias: "embedded3", label: "Embbeded 3", view: "textarea", value: ""},
|
||||
{ alias: "embedded4", label: "Embbeded 4", view: "datepicker", value: ""}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
return [200, node, null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return {
|
||||
register: function() {
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Content/GetById'))
|
||||
.respond(returnNodebyId);
|
||||
},
|
||||
expectGetById: function() {
|
||||
$httpBackend
|
||||
.expectGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Content/GetById'));
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -1,8 +1,8 @@
|
||||
angular.module('umbraco.mocks').
|
||||
factory('treeMocks', ['$httpBackend', 'mocksUtills', function ($httpBackend, mocksUtills) {
|
||||
'use strict';
|
||||
|
||||
function getMenuItems() {
|
||||
angular.module('umbraco.mocks').
|
||||
factory('treeMocks', ['$httpBackend', 'mocksUtills', function ($httpBackend, mocksUtills) {
|
||||
'use strict';
|
||||
|
||||
function getMenuItems() {
|
||||
return [
|
||||
{ name: "Create", cssclass: "plus", alias: "create" },
|
||||
|
||||
@@ -22,88 +22,91 @@ angular.module('umbraco.mocks').
|
||||
{ name: "Public Access", cssclass: "group", alias: "publicaccess" },
|
||||
|
||||
{ seperator: true, name: "Reload", cssclass: "refresh", alias: "users" }
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
function _getChildren(options) {
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
var section = options.section || 'content';
|
||||
var treeItem = options.node;
|
||||
|
||||
var iLevel = treeItem.level + 1;
|
||||
function returnChildren(status, data, headers) {
|
||||
|
||||
var id = mocksUtills.getParameterByName(data, "id");
|
||||
var section = mocksUtills.getParameterByName(data, "treeType");
|
||||
var level = mocksUtills.getParameterByName(data, "level")+1;
|
||||
|
||||
var url = "/umbraco/UmbracoTrees/ApplicationTreeApi/GetChildren?treeType=" + section + "&id=1234&level=" + level;
|
||||
//hack to have create as default content action
|
||||
var action;
|
||||
if (section === "content") {
|
||||
action = "create";
|
||||
if (section === "content") {
|
||||
action = "create";
|
||||
}
|
||||
|
||||
return [
|
||||
{ name: "child-of-" + treeItem.name, id: iLevel + "" + 1234, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1234, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: iLevel + "" + 1235, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1235, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: iLevel + "" + 1236, icon: "icon-file-alt", view: section + "/edit/" + iLevel + "" + 1236, children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: iLevel + "" + 1237, icon: "icon-file-alt", view: "common/legacy/1237?p=" + encodeURI("developer/contentType.aspx?idequal1234"), children: [], expanded: false, hasChildren: true, level: iLevel, defaultAction: action, menu: getMenuItems() }
|
||||
];
|
||||
var children = [
|
||||
{ name: "child-of-" + section, childNodesUrl:url, id: level + "" + 1234, icon: "icon-file-alt", view: section + "/edit/" + level + "" + 1234, children: [], expanded: false, hasChildren: true, level: level, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: level + "" + 1235, icon: "icon-file-alt", view: section + "/edit/" + level + "" + 1235, children: [], expanded: false, hasChildren: true, level: level, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: level + "" + 1236, icon: "icon-file-alt", view: section + "/edit/" + level + "" + 1236, children: [], expanded: false, hasChildren: true, level: level, defaultAction: action, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: level + "" + 1237, icon: "icon-file-alt", view: "common/legacy/1237?p=" + encodeURI("developer/contentType.aspx?idequal1234"), children: [], expanded: false, hasChildren: true, level: level, defaultAction: action, menu: getMenuItems() }
|
||||
];
|
||||
|
||||
return [200, children, null];
|
||||
}
|
||||
|
||||
function returnApplicationTrees(status, data, headers) {
|
||||
var section = mocksUtills.getParameterByName(data, "application");
|
||||
|
||||
function returnApplicationTrees(status, data, headers) {
|
||||
var section = mocksUtills.getParameterByName(data, "application");
|
||||
var url = "/umbraco/UmbracoTrees/ApplicationTreeApi/GetChildren?treeType=" + section + "&id=1234&level=1";
|
||||
var t;
|
||||
switch (section) {
|
||||
switch (section) {
|
||||
|
||||
case "content":
|
||||
t = [
|
||||
{ name: "My website", id: 1234, icon: "icon-home", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Components", id: 1235, icon: "icon-cogs", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Archieve", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Recycle Bin", id: 1237, icon: "icon-trash", view: section + "/trash/view/", children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() }
|
||||
{ name: "My website", id: 1234, childNodesUrl:url, icon: "icon-home", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Components", id: 1235, childNodesUrl:url, icon: "icon-cogs", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Archieve", id: 1236, childNodesUrl:url, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() },
|
||||
{ name: "Recycle Bin", id: 1237, childNodesUrl:url, icon: "icon-trash", view: section + "/trash/view/", children: [], expanded: false, hasChildren: true, level: 1, defaultAction: "create", menu: getMenuItems() }
|
||||
];
|
||||
break;
|
||||
|
||||
case "developer":
|
||||
t = [
|
||||
{ name: "Data types", id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Macros", id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Pacakges", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "XSLT Files", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Razor Files", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
{ name: "Data types", childNodesUrl:url, id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Macros", childNodesUrl:url, id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Pacakges", childNodesUrl:url, id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "XSLT Files", childNodesUrl:url, id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Razor Files", childNodesUrl:url, id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
];
|
||||
break;
|
||||
case "settings":
|
||||
t = [
|
||||
{ name: "Stylesheets", id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Templates", id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Dictionary", id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Media types", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Document types", id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
{ name: "Stylesheets", childNodesUrl:url, id: 1234, icon: "icon-folder-close", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Templates", childNodesUrl:url, id: 1235, icon: "icon-folder-close", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Dictionary", childNodesUrl:url, id: 1236, icon: "icon-folder-close", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Media types", childNodesUrl:url, id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "Document types", childNodesUrl:url, id: 1237, icon: "icon-folder-close", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
];
|
||||
break;
|
||||
default:
|
||||
t = [
|
||||
{ name: "random-name-" + section, id: 1234, icon: "icon-home", defaultAction: "create", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: 1235, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: 1236, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, id: 1237, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: 1234, icon: "icon-home", defaultAction: "create", view: section + "/edit/" + 1234, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: 1235, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1235, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: 1236, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1236, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() },
|
||||
{ name: "random-name-" + section, childNodesUrl:url, id: 1237, icon: "icon-folder-close", defaultAction: "create", view: section + "/edit/" + 1237, children: [], expanded: false, hasChildren: true, level: 1, menu: getMenuItems() }
|
||||
];
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return [200, t, null];
|
||||
return [200, t, null];
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
register: function() {
|
||||
|
||||
|
||||
|
||||
return {
|
||||
register: function() {
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoTrees/ApplicationTreeApi/GetApplicationTrees'))
|
||||
.respond(returnApplicationTrees);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
.respond(returnApplicationTrees);
|
||||
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoTrees/ApplicationTreeApi/GetChildren'))
|
||||
.respond(returnChildren);
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -2,8 +2,8 @@ angular.module("umbraco").controller("Umbraco.Editors.DatepickerController",
|
||||
function ($scope, notificationsService, scriptLoader) {
|
||||
|
||||
scriptLoader.load([
|
||||
'views/propertyeditors/umbraco/datepicker/bootstrap.datepicker.js',
|
||||
'css!/belle/views/propertyeditors/umbraco/datepicker/bootstrap.datepicker.css'
|
||||
'views/propertyeditors/datepicker/bootstrap.datepicker.js',
|
||||
'css!/belle/views/propertyeditors/datepicker/bootstrap.datepicker.css'
|
||||
]).then(
|
||||
function () {
|
||||
//The Datepicker js and css files are available and all components are ready to use.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div ng-controller="Umbraco.Editors.GridController" auto-scale="10">
|
||||
<iframe style="width: 100%; height: 100%;" src="views/propertyeditors/umbraco/grid/iframe.html"></iframe>
|
||||
<iframe style="width: 100%; height: 100%;" src="views/propertyeditors/grid/iframe.html"></iframe>
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="../../../../assets/css/umbraco.css" />
|
||||
<link rel="stylesheet" href="../../../assets/css/umbraco.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="../../../../lib/jquery/jquery.js"></script>
|
||||
<script src="../../../lib/jquery/jquery.js"></script>
|
||||
<script src="js/iframe.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,8 +4,8 @@ angular.module("umbraco")
|
||||
|
||||
scriptLoader.load(
|
||||
[
|
||||
'views/propertyeditors/umbraco/tags/bootstrap-tags.custom.js',
|
||||
'css!views/propertyeditors/umbraco/tags/bootstrap-tags.custom.css'
|
||||
'views/propertyeditors/tags/bootstrap-tags.custom.js',
|
||||
'css!views/propertyeditors/tags/bootstrap-tags.custom.css'
|
||||
]).then(function(){
|
||||
|
||||
// Get data from tagsFactory
|
||||
|
||||
@@ -16,6 +16,7 @@ describe('content type factory tests', function () {
|
||||
|
||||
|
||||
describe('global content type factory crud', function () {
|
||||
/*
|
||||
it('should return a content type object, given an id', function () {
|
||||
|
||||
var ct1;
|
||||
@@ -23,14 +24,15 @@ describe('content type factory tests', function () {
|
||||
ct1 = result;
|
||||
});
|
||||
|
||||
$rootScope.$digest();
|
||||
$rootScope.$apply();
|
||||
$rootScope.$digest();
|
||||
$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(){
|
||||
|
||||
@@ -41,9 +43,6 @@ describe('content type factory tests', function () {
|
||||
collection = result;
|
||||
});
|
||||
|
||||
|
||||
$rootScope.$digest();
|
||||
$rootScope.$apply();
|
||||
expect(collection.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user