11/*global Audit, Rule */
22describe ( 'Audit' , function ( ) {
33 'use strict' ;
4+ var ver = axe . version . substring ( 0 , axe . version . lastIndexOf ( '.' ) ) ;
45
56 var a , getFlattenedTree ;
67 var isNotCalled = function ( err ) {
@@ -117,7 +118,7 @@ describe('Audit', function() {
117118 audit . _constructHelpUrls ( ) ;
118119 assert . deepEqual ( audit . data . rules . target , {
119120 helpUrl :
120- 'https://dequeuniversity.com/rules/axe/x.y /target?application=axeAPI'
121+ 'https://dequeuniversity.com/rules/axe/' + ver + ' /target?application=axeAPI'
121122 } ) ;
122123 } ) ;
123124 it ( 'should use changed branding' , function ( ) {
@@ -133,7 +134,7 @@ describe('Audit', function() {
133134 audit . _constructHelpUrls ( ) ;
134135 assert . deepEqual ( audit . data . rules . target , {
135136 helpUrl :
136- 'https://dequeuniversity.com/rules/thing/x.y /target?application=axeAPI'
137+ 'https://dequeuniversity.com/rules/thing/' + ver + ' /target?application=axeAPI'
137138 } ) ;
138139 } ) ;
139140 it ( 'should use changed application' , function ( ) {
@@ -149,7 +150,7 @@ describe('Audit', function() {
149150 audit . _constructHelpUrls ( ) ;
150151 assert . deepEqual ( audit . data . rules . target , {
151152 helpUrl :
152- 'https://dequeuniversity.com/rules/axe/x.y /target?application=thing'
153+ 'https://dequeuniversity.com/rules/axe/' + ver + ' /target?application=thing'
153154 } ) ;
154155 } ) ;
155156
@@ -161,7 +162,7 @@ describe('Audit', function() {
161162 selector : 'bob' ,
162163 metadata : {
163164 helpUrl :
164- 'https://dequeuniversity.com/rules/myproject/x.y /target1?application=axeAPI'
165+ 'https://dequeuniversity.com/rules/myproject/' + ver + ' /target1?application=axeAPI'
165166 }
166167 } ) ;
167168 audit . addRule ( {
@@ -172,7 +173,7 @@ describe('Audit', function() {
172173
173174 assert . equal (
174175 audit . data . rules . target1 . helpUrl ,
175- 'https://dequeuniversity.com/rules/myproject/x.y /target1?application=axeAPI'
176+ 'https://dequeuniversity.com/rules/myproject/' + ver + ' /target1?application=axeAPI'
176177 ) ;
177178 assert . isUndefined ( audit . data . rules . target2 ) ;
178179
@@ -182,11 +183,11 @@ describe('Audit', function() {
182183
183184 assert . equal (
184185 audit . data . rules . target1 . helpUrl ,
185- 'https://dequeuniversity.com/rules/myproject/x.y /target1?application=axeAPI'
186+ 'https://dequeuniversity.com/rules/myproject/' + ver + ' /target1?application=axeAPI'
186187 ) ;
187188 assert . equal (
188189 audit . data . rules . target2 . helpUrl ,
189- 'https://dequeuniversity.com/rules/thing/x.y /target2?application=axeAPI'
190+ 'https://dequeuniversity.com/rules/thing/' + ver + ' /target2?application=axeAPI'
190191 ) ;
191192 } ) ;
192193 it ( 'understands prerelease type version numbers' , function ( ) {
@@ -207,24 +208,6 @@ describe('Audit', function() {
207208 'https://dequeuniversity.com/rules/axe/3.2/target?application=axeAPI'
208209 ) ;
209210 } ) ;
210- it ( 'sets x.y as version for invalid versions' , function ( ) {
211- var tempVersion = axe . version ;
212- var audit = new Audit ( ) ;
213- audit . addRule ( {
214- id : 'target' ,
215- matches : 'function () {return "hello";}' ,
216- selector : 'bob'
217- } ) ;
218-
219- axe . version = 'in-3.0-valid' ;
220- audit . _constructHelpUrls ( ) ;
221-
222- axe . version = tempVersion ;
223- assert . equal (
224- audit . data . rules . target . helpUrl ,
225- 'https://dequeuniversity.com/rules/axe/x.y/target?application=axeAPI'
226- ) ;
227- } ) ;
228211 it ( 'matches major release versions' , function ( ) {
229212 var tempVersion = axe . version ;
230213 var audit = new Audit ( ) ;
@@ -280,7 +263,7 @@ describe('Audit', function() {
280263 } ) ;
281264 assert . deepEqual ( audit . data . rules . target , {
282265 helpUrl :
283- 'https://dequeuniversity.com/rules/axe/x.y /target?application=thing'
266+ 'https://dequeuniversity.com/rules/axe/' + ver + ' /target?application=thing'
284267 } ) ;
285268 } ) ;
286269 it ( 'should call _constructHelpUrls even when nothing changed' , function ( ) {
@@ -295,7 +278,7 @@ describe('Audit', function() {
295278 audit . setBranding ( undefined ) ;
296279 assert . deepEqual ( audit . data . rules . target , {
297280 helpUrl :
298- 'https://dequeuniversity.com/rules/axe/x.y /target?application=axeAPI'
281+ 'https://dequeuniversity.com/rules/axe/' + ver + ' /target?application=axeAPI'
299282 } ) ;
300283 } ) ;
301284 it ( 'should not replace custom set branding' , function ( ) {
@@ -306,7 +289,7 @@ describe('Audit', function() {
306289 selector : 'bob' ,
307290 metadata : {
308291 helpUrl :
309- 'https://dequeuniversity.com/rules/customer-x/x.y /target?application=axeAPI'
292+ 'https://dequeuniversity.com/rules/customer-x/' + ver + ' /target?application=axeAPI'
310293 }
311294 } ) ;
312295 audit . setBranding ( {
@@ -315,7 +298,7 @@ describe('Audit', function() {
315298 } ) ;
316299 assert . equal (
317300 audit . data . rules . target . helpUrl ,
318- 'https://dequeuniversity.com/rules/customer-x/x.y /target?application=axeAPI'
301+ 'https://dequeuniversity.com/rules/customer-x/' + ver + ' /target?application=axeAPI'
319302 ) ;
320303 } ) ;
321304 } ) ;
0 commit comments