11/*global Audit, Rule, Promise */
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,9 @@ 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/' +
122+ ver +
123+ '/target?application=axeAPI'
121124 } ) ;
122125 } ) ;
123126 it ( 'should use changed branding' , function ( ) {
@@ -133,7 +136,9 @@ describe('Audit', function() {
133136 audit . _constructHelpUrls ( ) ;
134137 assert . deepEqual ( audit . data . rules . target , {
135138 helpUrl :
136- 'https://dequeuniversity.com/rules/thing/x.y/target?application=axeAPI'
139+ 'https://dequeuniversity.com/rules/thing/' +
140+ ver +
141+ '/target?application=axeAPI'
137142 } ) ;
138143 } ) ;
139144 it ( 'should use changed application' , function ( ) {
@@ -149,7 +154,9 @@ describe('Audit', function() {
149154 audit . _constructHelpUrls ( ) ;
150155 assert . deepEqual ( audit . data . rules . target , {
151156 helpUrl :
152- 'https://dequeuniversity.com/rules/axe/x.y/target?application=thing'
157+ 'https://dequeuniversity.com/rules/axe/' +
158+ ver +
159+ '/target?application=thing'
153160 } ) ;
154161 } ) ;
155162
@@ -161,7 +168,9 @@ describe('Audit', function() {
161168 selector : 'bob' ,
162169 metadata : {
163170 helpUrl :
164- 'https://dequeuniversity.com/rules/myproject/x.y/target1?application=axeAPI'
171+ 'https://dequeuniversity.com/rules/myproject/' +
172+ ver +
173+ '/target1?application=axeAPI'
165174 }
166175 } ) ;
167176 audit . addRule ( {
@@ -172,7 +181,9 @@ describe('Audit', function() {
172181
173182 assert . equal (
174183 audit . data . rules . target1 . helpUrl ,
175- 'https://dequeuniversity.com/rules/myproject/x.y/target1?application=axeAPI'
184+ 'https://dequeuniversity.com/rules/myproject/' +
185+ ver +
186+ '/target1?application=axeAPI'
176187 ) ;
177188 assert . isUndefined ( audit . data . rules . target2 ) ;
178189
@@ -182,11 +193,15 @@ describe('Audit', function() {
182193
183194 assert . equal (
184195 audit . data . rules . target1 . helpUrl ,
185- 'https://dequeuniversity.com/rules/myproject/x.y/target1?application=axeAPI'
196+ 'https://dequeuniversity.com/rules/myproject/' +
197+ ver +
198+ '/target1?application=axeAPI'
186199 ) ;
187200 assert . equal (
188201 audit . data . rules . target2 . helpUrl ,
189- 'https://dequeuniversity.com/rules/thing/x.y/target2?application=axeAPI'
202+ 'https://dequeuniversity.com/rules/thing/' +
203+ ver +
204+ '/target2?application=axeAPI'
190205 ) ;
191206 } ) ;
192207 it ( 'understands prerelease type version numbers' , function ( ) {
@@ -207,24 +222,6 @@ describe('Audit', function() {
207222 'https://dequeuniversity.com/rules/axe/3.2/target?application=axeAPI'
208223 ) ;
209224 } ) ;
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- } ) ;
228225 it ( 'matches major release versions' , function ( ) {
229226 var tempVersion = axe . version ;
230227 var audit = new Audit ( ) ;
@@ -258,7 +255,9 @@ describe('Audit', function() {
258255 audit . _constructHelpUrls ( ) ;
259256 assert . deepEqual ( audit . data . rules . target , {
260257 helpUrl :
261- 'https://dequeuniversity.com/rules/axe/x.y/target?application=axeAPI&lang=de'
258+ 'https://dequeuniversity.com/rules/axe/' +
259+ ver +
260+ '/target?application=axeAPI&lang=de'
262261 } ) ;
263262 } ) ;
264263 } ) ;
@@ -298,7 +297,9 @@ describe('Audit', function() {
298297 } ) ;
299298 assert . deepEqual ( audit . data . rules . target , {
300299 helpUrl :
301- 'https://dequeuniversity.com/rules/axe/x.y/target?application=thing'
300+ 'https://dequeuniversity.com/rules/axe/' +
301+ ver +
302+ '/target?application=thing'
302303 } ) ;
303304 } ) ;
304305 it ( 'should call _constructHelpUrls even when nothing changed' , function ( ) {
@@ -313,7 +314,9 @@ describe('Audit', function() {
313314 audit . setBranding ( undefined ) ;
314315 assert . deepEqual ( audit . data . rules . target , {
315316 helpUrl :
316- 'https://dequeuniversity.com/rules/axe/x.y/target?application=axeAPI'
317+ 'https://dequeuniversity.com/rules/axe/' +
318+ ver +
319+ '/target?application=axeAPI'
317320 } ) ;
318321 } ) ;
319322 it ( 'should not replace custom set branding' , function ( ) {
@@ -324,7 +327,9 @@ describe('Audit', function() {
324327 selector : 'bob' ,
325328 metadata : {
326329 helpUrl :
327- 'https://dequeuniversity.com/rules/customer-x/x.y/target?application=axeAPI'
330+ 'https://dequeuniversity.com/rules/customer-x/' +
331+ ver +
332+ '/target?application=axeAPI'
328333 }
329334 } ) ;
330335 audit . setBranding ( {
@@ -333,7 +338,9 @@ describe('Audit', function() {
333338 } ) ;
334339 assert . equal (
335340 audit . data . rules . target . helpUrl ,
336- 'https://dequeuniversity.com/rules/customer-x/x.y/target?application=axeAPI'
341+ 'https://dequeuniversity.com/rules/customer-x/' +
342+ ver +
343+ '/target?application=axeAPI'
337344 ) ;
338345 } ) ;
339346 } ) ;
0 commit comments