@@ -15,11 +15,6 @@ import Engine from '@ember/engine';
1515import { DEBUG } from '@glimmer/env' ;
1616import { compile } from '../../../utils/helpers' ;
1717
18- // IE includes the host name
19- function normalizeUrl ( url ) {
20- return url . replace ( / h t t p s ? : \/ \/ [ ^ / ] + / , '' ) ;
21- }
22-
2318function shouldNotBeActive ( assert , element ) {
2419 checkActive ( assert , element , false ) ;
2520}
@@ -152,9 +147,7 @@ moduleFor(
152147 // SVGAElement does not have a .click() method like HTMLElement,
153148 // so we dispatch a click event manually.
154149 let svgLink = document . querySelector ( '#svg-about-link' ) ;
155- let clickEvent = document . createEvent ( 'MouseEvents' ) ;
156- clickEvent . initMouseEvent ( 'click' , true , true ) ;
157- svgLink . dispatchEvent ( clickEvent ) ;
150+ svgLink . dispatchEvent ( new MouseEvent ( 'click' , { bubbles : true , cancelable : true } ) ) ;
158151 await runLoopSettled ( ) ;
159152
160153 assert . equal ( this . $ ( 'h3.about' ) . length , 1 , 'The about template was rendered' ) ;
@@ -870,7 +863,7 @@ moduleFor(
870863
871864 await this . visit ( '/about/item' ) ;
872865
873- assert . equal ( normalizeUrl ( this . $ ( '#item a' ) . attr ( 'href' ) ) , '/about' ) ;
866+ assert . equal ( this . $ ( '#item a' ) . attr ( 'href' ) , '/about' ) ;
874867 }
875868
876869 async [ `@test it supports custom, nested, current-when` ] ( assert ) {
@@ -1226,11 +1219,7 @@ moduleFor(
12261219 await this . visit ( '/about' ) ;
12271220
12281221 assert . equal ( this . $ ( 'h3.list' ) . length , 1 , 'The home template was rendered' ) ;
1229- assert . equal (
1230- normalizeUrl ( this . $ ( '#home-link' ) . attr ( 'href' ) ) ,
1231- '/' ,
1232- 'The home link points back at /'
1233- ) ;
1222+ assert . equal ( this . $ ( '#home-link' ) . attr ( 'href' ) , '/' , 'The home link points back at /' ) ;
12341223
12351224 await this . click ( '#yehuda' ) ;
12361225
@@ -1241,9 +1230,9 @@ moduleFor(
12411230
12421231 await this . click ( '#about-link' ) ;
12431232
1244- assert . equal ( normalizeUrl ( this . $ ( 'li a#yehuda' ) . attr ( 'href' ) ) , '/item/yehuda' ) ;
1245- assert . equal ( normalizeUrl ( this . $ ( 'li a#tom' ) . attr ( 'href' ) ) , '/item/tom' ) ;
1246- assert . equal ( normalizeUrl ( this . $ ( 'li a#erik' ) . attr ( 'href' ) ) , '/item/erik' ) ;
1233+ assert . equal ( this . $ ( 'li a#yehuda' ) . attr ( 'href' ) , '/item/yehuda' ) ;
1234+ assert . equal ( this . $ ( 'li a#tom' ) . attr ( 'href' ) , '/item/tom' ) ;
1235+ assert . equal ( this . $ ( 'li a#erik' ) . attr ( 'href' ) , '/item/erik' ) ;
12471236
12481237 await this . click ( '#erik' ) ;
12491238
@@ -1422,11 +1411,11 @@ moduleFor(
14221411
14231412 await this . visit ( '/filters/popular' ) ;
14241413
1425- assert . equal ( normalizeUrl ( this . $ ( '#link' ) . attr ( 'href' ) ) , '/filters/unpopular' ) ;
1426- assert . equal ( normalizeUrl ( this . $ ( '#path-link' ) . attr ( 'href' ) ) , '/filters/unpopular' ) ;
1427- assert . equal ( normalizeUrl ( this . $ ( '#post-path-link' ) . attr ( 'href' ) ) , '/post/123' ) ;
1428- assert . equal ( normalizeUrl ( this . $ ( '#post-number-link' ) . attr ( 'href' ) ) , '/post/123' ) ;
1429- assert . equal ( normalizeUrl ( this . $ ( '#repo-object-link' ) . attr ( 'href' ) ) , '/repo/ember/ember.js' ) ;
1414+ assert . equal ( this . $ ( '#link' ) . attr ( 'href' ) , '/filters/unpopular' ) ;
1415+ assert . equal ( this . $ ( '#path-link' ) . attr ( 'href' ) , '/filters/unpopular' ) ;
1416+ assert . equal ( this . $ ( '#post-path-link' ) . attr ( 'href' ) , '/post/123' ) ;
1417+ assert . equal ( this . $ ( '#post-number-link' ) . attr ( 'href' ) , '/post/123' ) ;
1418+ assert . equal ( this . $ ( '#repo-object-link' ) . attr ( 'href' ) , '/repo/ember/ember.js' ) ;
14301419 }
14311420
14321421 async [ `@test [GH#4201] Shorthand for route.index shouldn't throw errors about context arguments` ] (
@@ -1494,8 +1483,8 @@ moduleFor(
14941483 ) ;
14951484
14961485 let assertEquality = ( href ) => {
1497- assert . equal ( normalizeUrl ( this . $ ( '#string-link' ) . attr ( 'href' ) ) , '/' ) ;
1498- assert . equal ( normalizeUrl ( this . $ ( '#path-link' ) . attr ( 'href' ) ) , href ) ;
1486+ assert . equal ( this . $ ( '#string-link' ) . attr ( 'href' ) , '/' ) ;
1487+ assert . equal ( this . $ ( '#path-link' ) . attr ( 'href' ) , href ) ;
14991488 } ;
15001489
15011490 await this . visit ( '/' ) ;
@@ -1537,7 +1526,7 @@ moduleFor(
15371526 runTask ( ( ) => controller . set ( 'post' , post ) ) ;
15381527
15391528 assert . equal (
1540- normalizeUrl ( this . $ ( '#post' ) . attr ( 'href' ) ) ,
1529+ this . $ ( '#post' ) . attr ( 'href' ) ,
15411530 '/posts/1' ,
15421531 'precond - Link has rendered href attr properly'
15431532 ) ;
@@ -1631,9 +1620,8 @@ moduleFor(
16311620 let idx ;
16321621 for ( idx = 0 ; idx < links . length ; idx ++ ) {
16331622 let href = this . $ ( links [ idx ] ) . attr ( 'href' ) ;
1634- // Old IE includes the whole hostname as well
16351623 assert . equal (
1636- href . slice ( - expected [ idx ] . length ) ,
1624+ href ,
16371625 expected [ idx ] ,
16381626 `Expected link to be '${ expected [ idx ] } ', but was '${ href } '`
16391627 ) ;
@@ -1941,10 +1929,10 @@ moduleFor(
19411929
19421930 function assertLinkStatus ( link , url ) {
19431931 if ( url ) {
1944- assert . equal ( normalizeUrl ( link . attr ( 'href' ) ) , url , 'loaded link-to has expected href' ) ;
1932+ assert . equal ( link . attr ( 'href' ) , url , 'loaded link-to has expected href' ) ;
19451933 assert . ok ( ! link . hasClass ( 'i-am-loading' ) , 'loaded linkComponent has no loadingClass' ) ;
19461934 } else {
1947- assert . equal ( normalizeUrl ( link . attr ( 'href' ) ) , '#' , "unloaded link-to has href='#'" ) ;
1935+ assert . equal ( link . attr ( 'href' ) , '#' , "unloaded link-to has href='#'" ) ;
19481936 assert . ok ( link . hasClass ( 'i-am-loading' ) , 'loading linkComponent has loadingClass' ) ;
19491937 }
19501938 }
0 commit comments