@@ -34,7 +34,6 @@ function runWombatTest(testCase, done) {
34
34
window . assert = {
35
35
equal : function ( a , b ) {
36
36
if ( a !== b ) {
37
- x . equal ( a , b ) ;
38
37
console . error ( 'Mismatch between' , a , 'and' , b ) ;
39
38
throw new Error ( 'AssertionError' ) ;
40
39
}
@@ -133,8 +132,9 @@ describe('WombatJS', function () {
133
132
} ) ;
134
133
135
134
describe ( 'anchor rewriting' , function ( ) {
136
- it ( 'should rewrite links in dynamically injected <a> tags' , function ( done ) {
137
- runWombatTest ( {
135
+ var config ;
136
+ beforeEach ( function ( ) {
137
+ config = {
138
138
initScript : function ( ) {
139
139
wbinfo = {
140
140
wombat_opts : { } ,
@@ -144,13 +144,28 @@ describe('WombatJS', function () {
144
144
} ,
145
145
wombatScript : wombatScript ,
146
146
html : '<a href="foobar.html" id="link">A link</a>' ,
147
- testScript : function ( ) {
147
+ } ;
148
+ } ) ;
149
+
150
+ it ( 'should rewrite links in dynamically injected <a> tags' , function ( done ) {
151
+ config . testScript = function ( ) {
152
+ if ( domTests . areDOMPropertiesConfigurable ( ) ) {
148
153
var link = document . getElementById ( 'link' ) ;
149
- if ( domTests . areDOMPropertiesConfigurable ( ) ) {
150
- assert . equal ( link . href , 'http:///base/karma-tests/foobar.html' ) ;
151
- }
152
- } ,
153
- } , done ) ;
154
+ assert . equal ( link . href , 'http:///base/karma-tests/foobar.html' ) ;
155
+ }
156
+ } ;
157
+
158
+ runWombatTest ( config , done ) ;
159
+ } ) ;
160
+
161
+ it ( 'toString() should return the rewritten URL' , function ( done ) {
162
+ config . testScript = function ( ) {
163
+ if ( domTests . areDOMPropertiesConfigurable ( ) ) {
164
+ var link = document . getElementById ( 'link' ) ;
165
+ assert . equal ( link . href , link . toString ( ) ) ;
166
+ }
167
+ } ;
168
+ runWombatTest ( config , done ) ;
154
169
} ) ;
155
170
} ) ;
156
171
0 commit comments