From 7f67c032d17723fb31155124fe9d52e437590832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Mon, 25 May 2015 08:30:02 +0200 Subject: [PATCH] fix tests --- front/src/js/controllers/timelineCtrl.js | 10 -- test/core/customPoliciesTest.js | 182 +---------------------- 2 files changed, 1 insertion(+), 191 deletions(-) diff --git a/front/src/js/controllers/timelineCtrl.js b/front/src/js/controllers/timelineCtrl.js index 509774e..c641dc6 100644 --- a/front/src/js/controllers/timelineCtrl.js +++ b/front/src/js/controllers/timelineCtrl.js @@ -41,16 +41,6 @@ timelineCtrl.controller('TimelineCtrl', ['$scope', '$rootScope', '$routeParams', eventNotDelegated: (filter === null || filter === 'eventNotDelegated'), jsError: (filter === null || filter === 'jsError') }; - - // If a filter is defined in the hash (ie: "/result/xxxxx/timeline#filter=queryWithoutResults") - var hash = $location.hash(); - if (hash.indexOf('filter=') === 0) { - var filter = hash.substr(7); - $scope.warningsFilterOn = true; - for (var key in $scope.warningsFilter) { - - } - } } function initScriptFiltering() { diff --git a/test/core/customPoliciesTest.js b/test/core/customPoliciesTest.js index abfb601..784bf64 100644 --- a/test/core/customPoliciesTest.js +++ b/test/core/customPoliciesTest.js @@ -1,7 +1,7 @@ var should = require('chai').should(); var rulesChecker = require('../../lib/rulesChecker'); -describe('rulesChecker', function() { +describe('customPolicies', function() { var policies = require('../../lib/metadata/policies.js'); var results; @@ -70,131 +70,6 @@ describe('rulesChecker', function() { }); }); - - it('should transform DOMinserts offenders', function() { - results = rulesChecker.check({ - "toolsResults": { - "phantomas": { - "metrics": { - "DOMinserts": 4 - }, - "offenders": { - "DOMinserts": [ - "\"div\" appended to \"html\"", - "\"DocumentFragment > link[0]\" appended to \"head\"", - "\"div#Netaff-yh1XbS0vK3NaRGu\" appended to \"body > div#Global\"", - "\"img\" appended to \"body\"" - ] - } - } - } - }, policies); - - results.should.have.a.property('DOMinserts'); - results.DOMinserts.should.have.a.property('offendersObj').that.deep.equals({ - "count": 4, - "list": [ - { - "insertedElement": { - "type": "createdElement", - "element": "div" - }, - "receiverElement": { - "type": "html" - } - }, - { - "insertedElement": { - "type": "fragmentElement", - "element": "link[0]", - "tree": { - "DocumentFragment": { - "link[0]": 1 - } - } - }, - "receiverElement": { - "type": "head" - } - }, - { - "insertedElement": { - "type": "createdElement", - "element": "div#Netaff-yh1XbS0vK3NaRGu" - }, - "receiverElement": { - "type": "domElement", - "element": "div#Global", - "tree": { - "body": { - "div#Global": 1 - } - } - } - }, - { - "insertedElement": { - "type": "createdElement", - "element": "img" - }, - "receiverElement": { - "type": "body" - } - } - ] - }); - }); - - - it('should transform DOMqueriesWithoutResults offenders', function() { - results = rulesChecker.check({ - "toolsResults": { - "phantomas": { - "metrics": { - "DOMqueriesWithoutResults": 2 - }, - "offenders": { - "DOMqueriesWithoutResults": [ - "#SearchMenu (in #document) using getElementById", - ".partnership-link (in body > div#Global > div#Header > ul#MainMenu) using getElementsByClassName" - ] - } - } - } - }, policies); - - results.should.have.a.property('DOMqueriesWithoutResults'); - results.DOMqueriesWithoutResults.should.have.a.property('offendersObj').that.deep.equals({ - "count": 2, - "list": [ - { - "context": { - "type": "document" - }, - "fn": "getElementById", - "query": "#SearchMenu " - }, - { - "context": { - "element": "ul#MainMenu", - "tree": { - "body": { - "div#Global": { - "div#Header": { - "ul#MainMenu": 1 - } - } - } - }, - "type": "domElement" - }, - "fn": "getElementsByClassName", - "query": ".partnership-link " - } - ] - }); - }); - it('should transform DOMqueriesAvoidable offenders', function() { results = rulesChecker.check({ @@ -246,61 +121,6 @@ describe('rulesChecker', function() { }); - it('should transform eventsBound offenders', function() { - results = rulesChecker.check({ - "toolsResults": { - "phantomas": { - "metrics": { - "eventsBound": 2 - }, - "offenders": { - "eventsBound": [ - "\"DOMContentLoaded\" bound to \"#document\"", - "\"unload\" bound to \"window\"", - "\"submit\" bound to \"body > div#Global > div#Header > form#search_mini_form\"" - ] - } - } - } - }, policies); - - results.should.have.a.property('eventsBound'); - results.eventsBound.should.have.a.property('offendersObj').that.deep.equals({ - "count": 3, - "list": [ - { - "element": { - "type": "document" - }, - "eventName": "DOMContentLoaded" - }, - { - "element": { - "type": "window" - }, - "eventName": "unload" - }, - { - "element": { - "element": "form#search_mini_form", - "tree": { - "body": { - "div#Global": { - "div#Header": { - "form#search_mini_form": 1 - } - } - } - }, - "type": "domElement" - }, - "eventName": "submit" - } - ] - }); - }); - - it('should transform jsErrors offenders', function() { results = rulesChecker.check({ "toolsResults": {