Mathijs den Burger pushed to branch bugfix/cm-overlay-CHANNELMGR-1102 at 
cms-community / hippo-addon-channel-manager


Commits:
ed69d3f8 by Mathijs den Burger at 2017-01-24T14:46:12+01:00
CHANNELMGR-1102 Load hippo-iframe.css as string

- - - - -
ec7b7c96 by Mathijs den Burger at 2017-01-24T14:51:58+01:00
CHANNELMGR-1102 Inject hippo-iframe.css manually in test

The file moved to /styles/string/ and can therefore only be
imported as string. To include it in the test iframe we inject it
manually using the DomService.

- - - - -


5 changed files:

- frontend-ng/build.conf.js
- frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
- frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.spec.js
- 
frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.iframe.fixture.html
- frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.spec.js


Changes:

=====================================
frontend-ng/build.conf.js
=====================================
--- a/frontend-ng/build.conf.js
+++ b/frontend-ng/build.conf.js
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2016 Hippo B.V. (http://www.onehippo.com)
+ * Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com)
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,14 +48,9 @@ const customConfig = {
       'node_modules/dragula/dist/dragula.min.js',
       'node_modules/dragula/dist/dragula.min.css',
       'node_modules/jquery/dist/jquery.js',
-      {
-        pattern: 'src/styles/hippo-iframe.css',
-        included: false,
-      },
     ],
     proxies: {
       '/styles/dragula.min.css': 
'/base/node_modules/dragula/dist/dragula.min.css',
-      '/styles/hippo-iframe.css': '/base/src/styles/hippo-iframe.css',
       '/scripts/dragula.min.js': 
'/base/node_modules/dragula/dist/dragula.min.js',
     },
   },


=====================================
frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
=====================================
--- a/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
+++ b/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-import hippoIframeCss from '../../../styles/iframe/hippo-iframe.scss';
+import hippoIframeCss from '../../../styles/string/hippo-iframe.scss';
 
 class HippoIframeCtrl {
   constructor(
@@ -162,7 +162,7 @@ class HippoIframeCtrl {
         return this.$q.reject();
       }
       const iframeWindow = iframeDom.defaultView;
-      this.DomService.addCss(iframeWindow, hippoIframeCss.toString());
+      this.DomService.addCss(iframeWindow, hippoIframeCss);
       return this.$q.resolve();
     } catch (e) {
       return this.$q.reject();


=====================================
frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.spec.js
=====================================
--- 
a/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.spec.js
+++ 
b/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.spec.js
@@ -170,7 +170,7 @@ describe('hippoIframeCtrl', () => {
     hippoIframeCtrl.onLoad();
     $rootScope.$digest();
 
-    expect(DomService.addCss).toHaveBeenCalledWith(window, '[object Object]');
+    expect(DomService.addCss).toHaveBeenCalledWith(window, 
jasmine.any(String));
     expect(PageStructureService.clearParsedElements).toHaveBeenCalled();
     expect(ScalingService.onIframeReady).toHaveBeenCalled();
     expect(hstCommentsProcessorService.run).toHaveBeenCalled();


=====================================
frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.iframe.fixture.html
=====================================
--- 
a/frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.iframe.fixture.html
+++ 
b/frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.iframe.fixture.html
@@ -16,7 +16,6 @@
 <html>
   <head>
     <title>Iframe title</title>
-    <link rel="stylesheet" href="/styles/hippo-iframe.css"/>
     <style type="text/css">
       * {
         padding: 0;


=====================================
frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.spec.js
=====================================
--- 
a/frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.spec.js
+++ 
b/frontend-ng/src/angularjs/channel/hippoIframe/overlay/overlay.service.spec.js
@@ -14,10 +14,13 @@
  * limitations under the License.
  */
 
+import hippoIframeCss from '../../../../styles/string/hippo-iframe.scss';
+
 describe('OverlayService', () => {
   let $q;
   let $rootScope;
   let CmsService;
+  let DomService;
   let hstCommentsProcessorService;
   let OverlayService;
   let PageStructureService;
@@ -28,11 +31,12 @@ describe('OverlayService', () => {
   beforeEach(() => {
     angular.mock.module('hippo-cm.channel.hippoIframe');
 
-    inject((_$q_, _$rootScope_, _CmsService_, _hstCommentsProcessorService_, 
_OverlayService_,
+    inject((_$q_, _$rootScope_, _CmsService_, _DomService_, 
_hstCommentsProcessorService_, _OverlayService_,
             _PageStructureService_, _RenderingService_) => {
       $q = _$q_;
       $rootScope = _$rootScope_;
       CmsService = _CmsService_;
+      DomService = _DomService_;
       hstCommentsProcessorService = _hstCommentsProcessorService_;
       OverlayService = _OverlayService_;
       PageStructureService = _PageStructureService_;
@@ -47,6 +51,7 @@ describe('OverlayService', () => {
     OverlayService.init($iframe);
     $iframe.one('load', () => {
       iframeWindow = $iframe[0].contentWindow;
+      DomService.addCss(iframeWindow, hippoIframeCss);
       try {
         hstCommentsProcessorService.run(
           iframeWindow.document,



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/0e266a232ee6455a5c11b79b9561ae8b790dacb6...ec7b7c96ab3777e33f86be5f9fdfa895ae8d038b
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to