@@ -24,8 +24,8 @@ test.describe('leaves ranges intact when nothing to change', () => {
2424 // Expect the incomplete coverage reported by the browser
2525 expect ( coverage . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 0 , end : 17 } ] )
2626
27- let result = extend_ranges ( coverage )
28- expect ( result . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 0 , end : 17 } ] )
27+ let result = extend_ranges ( coverage [ 0 ] )
28+ expect ( result . ranges ) . toEqual ( [ { start : 0 , end : 17 } ] )
2929 } )
3030} )
3131
@@ -37,8 +37,8 @@ test.describe('@rules', () => {
3737 // Expect the incomplete coverage reported by the browser
3838 expect ( coverage . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 7 , end : 42 } ] ) // (min-width:100px){body{color:green}
3939
40- let result = extend_ranges ( coverage )
41- expect ( result . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 0 , end : 43 } ] ) // @media (min-width:100px){body{color:green}}
40+ let result = extend_ranges ( coverage [ 0 ] )
41+ expect ( result . ranges ) . toEqual ( [ { start : 0 , end : 43 } ] ) // @media (min-width:100px){body{color:green}}
4242 } )
4343
4444 test . describe ( 'adjecent to uncovered code' , ( ) => {
@@ -49,8 +49,8 @@ test.describe('@rules', () => {
4949 // Expect the incomplete coverage reported by the browser
5050 expect ( coverage . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 10 , end : 45 } ] ) // (min-width:100px){body{color:green}
5151
52- let result = extend_ranges ( coverage )
53- expect ( result . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 3 , end : 46 } ] ) // @media (min-width:100px){body{color:green}}
52+ let result = extend_ranges ( coverage [ 0 ] )
53+ expect ( result . ranges ) . toEqual ( [ { start : 3 , end : 46 } ] ) // @media (min-width:100px){body{color:green}}
5454 } )
5555
5656 test ( '@media at start' , async ( ) => {
@@ -60,8 +60,8 @@ test.describe('@rules', () => {
6060 // Expect the incomplete coverage reported by the browser
6161 expect ( coverage . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 7 , end : 42 } ] ) // (min-width:100px){body{color:green}
6262
63- let result = extend_ranges ( coverage )
64- expect ( result . at ( 0 ) ! . ranges ) . toEqual ( [ { start : 0 , end : 43 } ] ) // @media (min-width:100px){body{color:green}}
63+ let result = extend_ranges ( coverage [ 0 ] )
64+ expect ( result . ranges ) . toEqual ( [ { start : 0 , end : 43 } ] ) // @media (min-width:100px){body{color:green}}
6565 } )
6666 } )
6767
@@ -71,57 +71,49 @@ test.describe('@rules', () => {
7171 let coverage = ( await generate_coverage ( html , { link_css : css } ) ) as Coverage [ ]
7272
7373 // Expect the incomplete coverage reported by the browser
74- expect ( coverage ) . toEqual ( [
75- {
76- url : 'http://localhost/style.css' ,
77- text : css ,
78- ranges : [
79- { start : 0 , end : 12 } , // p{color:red}
80- { start : 19 , end : 54 } , // (min-width:100px){body{color:green}
81- ] ,
82- } ,
83- ] )
84-
85- let result = extend_ranges ( coverage )
86- expect ( result ) . toEqual ( [
87- {
88- url : 'http://localhost/style.css' ,
89- text : css ,
90- ranges : [
91- { start : 0 , end : 12 } , // p{color:red}
92- { start : 12 , end : 55 } , // @media (min-width:100px){body{color:green}}
93- ] ,
94- } ,
95- ] )
74+ expect ( coverage [ 0 ] ) . toEqual ( {
75+ url : 'http://localhost/style.css' ,
76+ text : css ,
77+ ranges : [
78+ { start : 0 , end : 12 } , // p{color:red}
79+ { start : 19 , end : 54 } , // (min-width:100px){body{color:green}
80+ ] ,
81+ } )
82+
83+ let result = extend_ranges ( coverage [ 0 ] )
84+ expect ( result ) . toEqual ( {
85+ url : 'http://localhost/style.css' ,
86+ text : css ,
87+ ranges : [
88+ { start : 0 , end : 12 } , // p{color:red}
89+ { start : 12 , end : 55 } , // @media (min-width:100px){body{color:green}}
90+ ] ,
91+ } )
9692 } )
9793
9894 test ( '@media at start' , async ( ) => {
9995 let css = `@media (min-width:100px){body{color:green}}p{color:red}`
10096 let coverage = ( await generate_coverage ( html , { link_css : css } ) ) as Coverage [ ]
10197
10298 // Expect the incomplete coverage reported by the browser
103- expect ( coverage ) . toEqual ( [
104- {
105- url : 'http://localhost/style.css' ,
106- text : css ,
107- ranges : [
108- { start : 7 , end : 42 } , // (min-width:100px){body{color:green}
109- { start : 43 , end : 55 } , // p{color:red}
110- ] ,
111- } ,
112- ] )
113-
114- let result = extend_ranges ( coverage )
115- expect ( result ) . toEqual ( [
116- {
117- url : 'http://localhost/style.css' ,
118- text : css ,
119- ranges : [
120- { start : 0 , end : 43 } , // @media (min-width:100px){body{color:green}}
121- { start : 43 , end : 55 } , // p{color:red}
122- ] ,
123- } ,
124- ] )
99+ expect ( coverage [ 0 ] ) . toEqual ( {
100+ url : 'http://localhost/style.css' ,
101+ text : css ,
102+ ranges : [
103+ { start : 7 , end : 42 } , // (min-width:100px){body{color:green}
104+ { start : 43 , end : 55 } , // p{color:red}
105+ ] ,
106+ } )
107+
108+ let result = extend_ranges ( coverage [ 0 ] )
109+ expect ( result ) . toEqual ( {
110+ url : 'http://localhost/style.css' ,
111+ text : css ,
112+ ranges : [
113+ { start : 0 , end : 43 } , // @media (min-width:100px){body{color:green}}
114+ { start : 43 , end : 55 } , // p{color:red}
115+ ] ,
116+ } )
125117 } )
126118 } )
127119} )
0 commit comments