From db4495cf50a0d994811479a7709524eade9bcca6 Mon Sep 17 00:00:00 2001 From: Per Ploug Krogslund Date: Fri, 7 Nov 2014 11:13:28 +0100 Subject: [PATCH] Grid mock data and modified tests all client side changes, will not affect live sites --- src/Umbraco.Web.UI.Client/gruntFile.js | 14 ++- .../src/common/mocks/resources/_utils.js | 100 ++++++++++++++---- .../src/common/mocks/resources/tree.mocks.js | 2 +- .../src/common/mocks/umbraco.httpbackend.js | 1 + .../src/config/grid.editors.config.js | 46 ++++++++ .../content/edit-content-controller.spec.js | 2 +- .../services/content-editing-helper.spec.js | 2 +- 7 files changed, 141 insertions(+), 26 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/config/grid.editors.config.js diff --git a/src/Umbraco.Web.UI.Client/gruntFile.js b/src/Umbraco.Web.UI.Client/gruntFile.js index 4c5a5db5d7..76028f1f04 100644 --- a/src/Umbraco.Web.UI.Client/gruntFile.js +++ b/src/Umbraco.Web.UI.Client/gruntFile.js @@ -18,8 +18,9 @@ module.exports = function (grunt) { //triggered from grunt dev or grunt grunt.registerTask('build', ['clean', 'concat', 'recess:min', 'recess:installer', 'recess:canvasdesigner', 'bower', 'copy']); - //build-dev doesn't min - we are trying to speed this up and we don't want minified stuff when we are in dev mode - grunt.registerTask('build-dev', ['clean', 'concat', 'recess:build', 'recess:installer', 'copy']); + + //build-dev doesn't min - we are trying to speed this up and we don't want minified stuff when we are in dev mode + grunt.registerTask('build-dev', ['clean', 'concat', 'recess:build', 'recess:installer', 'copy']); //utillity tasks grunt.registerTask('docs', ['ngdocs']); @@ -31,9 +32,9 @@ module.exports = function (grunt) { grunt.log.subhead(Date()); }); - // Custom task to run the bower dependency installer - // tried, a few other things but this seems to work the best. - // https://coderwall.com/p/xnkdqw + // Custom task to run the bower dependency installer + // tried, a few other things but this seems to work the best. + // https://coderwall.com/p/xnkdqw grunt.registerTask('bower', 'Get js packages listed in bower.json', function () { var bower = require('bower'); @@ -137,6 +138,9 @@ module.exports = function (grunt) { files: [{ dest: '<%= distdir %>/assets', src : '**', expand: true, cwd: 'src/assets/' }] }, + config: { + files: [{ dest: '<%= distdir %>/../config', src : '**', expand: true, cwd: 'src/config/' }] + }, // Copies over the files downloaded by bower bower: { diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js index 52ddd13204..0382f62220 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js @@ -55,11 +55,91 @@ angular.module('umbraco.mocks'). allowedActions: ["U", "H", "A"], tabs: [ { - label: "Child documents", + label: "Grid", id: 1, active: true, properties: [ - { alias: "list", label: "List", view: "listview", value: "", hideLabel: true, config:{entityType: "content"} }, + { alias: "grid", + label: "Grid", + view: "grid", + value: "", + hideLabel: true, + config: { + items:{ + + styles:[ + { + label: "Set a background image", + description: "Set a row background", + key: "background-image", + view: "imagepicker", + modifier: "url({0})" + } + ], + config:[ + { + label: "Class", + description: "Set a css class", + key: "class", + view: "textstring" + } + ], + columns: 12, + templates:[ + { + name: "1 column layout", + sections: [ + { + grid: 12, + } + ] + }, + { + name: "2 column layout", + sections: [ + { + grid: 4, + }, + { + grid: 8 + } + ] + } + ], + + + layouts:[ + { + name: "Headline", + areas: [ + { + grid: 12, + editors: ["headline"] + } + ] + }, + { + name: "Article", + areas: [ + { + grid: 12 + }, + { + grid: 4 + }, + { + grid: 8 + }, + { + grid: 12 + } + ] + } + ] + } + + } + }, ] }, { @@ -111,22 +191,6 @@ angular.module('umbraco.mocks'). ] }, { - label: "Tab # 7", - id: 7, - properties: [ - { alias: "valTest7", label: "Validation test", view: "validationtest", value: "asdfasdf" }, - { alias: "bodyText7", label: "Body Text", description: "Here you enter the primary article contents", view: "rte", value: "

askjdkasj lasjd

", config: {} }, - { alias: "textarea7", label: "textarea", view: "textarea", value: "ajsdka sdjkds", config: { rows: 4 } }, - { alias: "content7", label: "Content picker", view: "contentpicker", value: "1234,23242,23232,23231" } - ] - }, - { - label: "Grid", - id: 8, - properties: [ - { alias: "canvas", label: "Grid", view: "canvas", value: "test", hideLabel: true } - ] - }, { label: "Generic Properties", id: 0, properties: [ diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/tree.mocks.js b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/tree.mocks.js index 881c0f8b67..1ecc0b5cf8 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/tree.mocks.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/tree.mocks.js @@ -78,7 +78,7 @@ angular.module('umbraco.mocks'). { name: "Multiple textstring", childNodesUrl: null, id: 11, icon: "icon-document", children: [], expanded: false, hasChildren: false, level: 1, menuUrl: null }, { name: "Yes/No", childNodesUrl: null, id: 12, icon: "icon-document", children: [], expanded: false, hasChildren: false, level: 1, menuUrl: null }, { name: "Rich Text Editor", childNodesUrl: null, id: 13, icon: "icon-document", children: [], expanded: false, hasChildren: false, level: 1, menuUrl: null } - ]; + ]; return [200, children, null]; } diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.httpbackend.js b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.httpbackend.js index 372fb69c95..caccb92def 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.httpbackend.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.httpbackend.js @@ -20,6 +20,7 @@ function initBackEnd($httpBackend, contentMocks, mediaMocks, treeMocks, userMock prevaluesMocks.register(); entityMocks.register(); + $httpBackend.whenGET(/^..\/config\//).passThrough(); $httpBackend.whenGET(/^views\//).passThrough(); $httpBackend.whenGET(/^js\//).passThrough(); $httpBackend.whenGET(/^lib\//).passThrough(); diff --git a/src/Umbraco.Web.UI.Client/src/config/grid.editors.config.js b/src/Umbraco.Web.UI.Client/src/config/grid.editors.config.js new file mode 100644 index 0000000000..3b1e2b7083 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/config/grid.editors.config.js @@ -0,0 +1,46 @@ +[ + { + "name": "Rich text editor", + "alias": "rte", + "view": "rte", + "icon": "icon-article" + }, + { + "name": "Image", + "alias": "media", + "view": "media", + "icon": "icon-picture" + }, + { + "name": "Macro", + "alias": "macro", + "view": "macro", + "icon": "icon-settings-alt" + }, + { + "name": "Embed", + "alias": "embed", + "view": "embed", + "icon": "icon-movie-alt" + }, + { + "name": "Headline", + "alias": "headline", + "view": "textstring", + "icon": "icon-coin", + "config": { + "style": "font-size: 36px; line-height: 45px; font-weight: bold", + "markup": "

#value#

" + } + }, + { + "name": "Quote", + "alias": "quote", + "view": "textstring", + "icon": "icon-quote", + "config": { + "style": "border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px", + "markup": "
#value#
" + } + } +] \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/test/unit/app/content/edit-content-controller.spec.js b/src/Umbraco.Web.UI.Client/test/unit/app/content/edit-content-controller.spec.js index e30a92bbe9..0fc5a4cedd 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/app/content/edit-content-controller.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/app/content/edit-content-controller.spec.js @@ -48,7 +48,7 @@ describe('edit content controller tests', function () { }); it('it should have a tabs collection', function () { - expect(scope.content.tabs.length).toBe(9); + expect(scope.content.tabs.length).toBe(7); }); it('it should have a properties collection on each tab', function () { diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/services/content-editing-helper.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/services/content-editing-helper.spec.js index 0c0b374e34..0fa55c2a11 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/services/content-editing-helper.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/services/content-editing-helper.spec.js @@ -229,7 +229,7 @@ describe('contentEditingHelper tests', function () { //assert expect(changed.length).toBe(2); - expect(changed[0].alias).toBe("list"); + expect(changed[0].alias).toBe("grid"); expect(changed[1].alias).toBe("bodyText"); });