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,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 ( ) ;
@@ -280,7 +277,9 @@ describe('Audit', function() {
280277 } ) ;
281278 assert . deepEqual ( audit . data . rules . target , {
282279 helpUrl :
283- 'https://dequeuniversity.com/rules/axe/x.y/target?application=thing'
280+ 'https://dequeuniversity.com/rules/axe/' +
281+ ver +
282+ '/target?application=thing'
284283 } ) ;
285284 } ) ;
286285 it ( 'should call _constructHelpUrls even when nothing changed' , function ( ) {
@@ -295,7 +294,9 @@ describe('Audit', function() {
295294 audit . setBranding ( undefined ) ;
296295 assert . deepEqual ( audit . data . rules . target , {
297296 helpUrl :
298- 'https://dequeuniversity.com/rules/axe/x.y/target?application=axeAPI'
297+ 'https://dequeuniversity.com/rules/axe/' +
298+ ver +
299+ '/target?application=axeAPI'
299300 } ) ;
300301 } ) ;
301302 it ( 'should not replace custom set branding' , function ( ) {
@@ -306,7 +307,9 @@ describe('Audit', function() {
306307 selector : 'bob' ,
307308 metadata : {
308309 helpUrl :
309- 'https://dequeuniversity.com/rules/customer-x/x.y/target?application=axeAPI'
310+ 'https://dequeuniversity.com/rules/customer-x/' +
311+ ver +
312+ '/target?application=axeAPI'
310313 }
311314 } ) ;
312315 audit . setBranding ( {
@@ -315,7 +318,9 @@ describe('Audit', function() {
315318 } ) ;
316319 assert . equal (
317320 audit . data . rules . target . helpUrl ,
318- 'https://dequeuniversity.com/rules/customer-x/x.y/target?application=axeAPI'
321+ 'https://dequeuniversity.com/rules/customer-x/' +
322+ ver +
323+ '/target?application=axeAPI'
319324 ) ;
320325 } ) ;
321326 } ) ;
0 commit comments