Arthur Bogaart pushed to branch feature/cmng-psp1 at cms-community / hippo-addon-channel-manager
Commits: 5559680d by Arthur Bogaart at 2016-02-23T00:49:01+01:00 CHANNELMGR-339 Add missing license and simplify test Merged broken JSON fixture with generic fixture file - - - - - 3 changed files: - frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.fixture.html - − frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.invalid.json.fixture.html - frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.spec.js Changes: ===================================== frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.fixture.html ===================================== --- a/frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.fixture.html +++ b/frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.fixture.html @@ -1,6 +1,32 @@ +<!-- + Copyright 2016 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. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + <div id="qa-page"> <!----> + <!-- {Skip this comment} --> + <!-- Skip this comment --> + + <div id="qa-invalid-json"> + <!-- { + "HST-Type":"INVALID_JSON" + "name":"invalid-json" + } --> + </div> + <!--[if IE]> <div id="ie-only1"> @@ -8,26 +34,19 @@ </div> <![endif]--> - <!-- {Ignore this comment} --> - <!-- { - "HST-Type":"CONTAINER_COMPONENT", - "name":"Container-1" -} --> -<div id="qa-container1"> - <!-- { - "HST-Type":"CONTAINER_ITEM_COMPONENT", - "name":"Container-1-Item-1" + "HST-Type":"CONTAINER_COMPONENT", + "name":"Container-1" } --> - <div id="qa-item1"> - <!-- This comment will be ignored --> - <p>Item 1</p> + <div id="qa-container1"> + <!-- {"HST-Type":"CONTAINER_ITEM_COMPONENT","name":"Container-1-Item-1"} --> + <div id="qa-item1"> + <p>Item 1</p> + </div> </div> -</div> </div> <!-- { "HST-Type":"PAGE-META-DATA", "name": "Page-1" } --> -<!-- This comment will be ignored --> ===================================== frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.invalid.json.fixture.html deleted ===================================== --- a/frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.invalid.json.fixture.html +++ /dev/null @@ -1,6 +0,0 @@ -<div id="qa-page"> - <!-- { - "HST-Type":"CONTAINER_COMPONENT" - "name":"Container-1" -} --> -</div> ===================================== frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.spec.js ===================================== --- a/frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.spec.js +++ b/frontend-ng/src/angularjs/channel/hippoIframe/hstCommentsProcessor.service.spec.js @@ -1,3 +1,19 @@ +/* + * Copyright 2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + describe('HstCommentsProcessorService', function () { 'use strict'; @@ -10,11 +26,12 @@ describe('HstCommentsProcessorService', function () { inject(function (_hstCommentsProcessorService_) { hstCommentsProcessorService = _hstCommentsProcessorService_; }); + + jasmine.getFixtures().load('channel/hippoIframe/hstCommentsProcessor.service.fixture.html'); }); // PhantomJS does not support XPath querying through document.evaluate (https://github.com/ariya/phantomjs/issues/10161) it('should use DOM-walking when XPath querying is not available', function () { - jasmine.getFixtures().load('channel/hippoIframe/hstCommentsProcessor.service.fixture.html'); spyOn(hstCommentsProcessorService, 'processCommentsWithDomWalking'); hstCommentsProcessorService.run($j('#jasmine-fixtures')[0], NOOP); expect(hstCommentsProcessorService.processCommentsWithDomWalking).toHaveBeenCalled(); @@ -22,9 +39,9 @@ describe('HstCommentsProcessorService', function () { it('should process comments with DOM-walking', function () { + var fixture = $j('#jasmine-fixtures')[0]; var gatheredData = []; - jasmine.getFixtures().load('channel/hippoIframe/hstCommentsProcessor.service.fixture.html'); - hstCommentsProcessorService.processCommentsWithDomWalking($j('#jasmine-fixtures')[0], function (element, json) { + hstCommentsProcessorService.processCommentsWithDomWalking(fixture, function (element, json) { gatheredData.push(json); }); @@ -41,11 +58,10 @@ describe('HstCommentsProcessorService', function () { it('should not invoke callback when JSON data is invalid', function () { + var fixture = $j('#qa-invalid-json')[0]; var observer = { callback: NOOP }; spyOn(observer, 'callback'); - - jasmine.getFixtures().load('channel/hippoIframe/hstCommentsProcessor.service.invalid.json.fixture.html'); - hstCommentsProcessorService.processCommentsWithDomWalking($j('#jasmine-fixtures')[0], observer.callback); + hstCommentsProcessorService.processCommentsWithDomWalking(fixture, observer.callback); expect(observer.callback).not.toHaveBeenCalled(); }); View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/5559680d5e4d9947b6e745237542b392fa34c84c
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn