@@ -19,7 +19,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
1919 margin: 20px 10px;
2020 background-image: url('tryme.png');
2121}
22-
22+
2323.boo .hoo {
2424 margin: 10px;
2525}
@@ -46,7 +46,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
4646</head>
4747<body>
4848 <div>
49-
49+ \t\t
5050 </div>
5151 <div class="header">
5252 <ul class="nav main">
@@ -113,6 +113,43 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
113113 } ) ;
114114 } ) ;
115115
116+ test ( 'Emmet Next/Prev Item in html template' , function ( ) : any {
117+ const templateContents = `
118+ <script type="text/template">
119+ <div class="header">
120+ <ul class="nav main">
121+ </ul>
122+ </div>
123+ </script>
124+ ` ;
125+ return withRandomFileEditor ( templateContents , '.html' , ( editor , doc ) => {
126+ editor . selections = [ new Selection ( 2 , 2 , 2 , 2 ) ] ;
127+
128+ let expectedNextItemPoints : [ number , number , number ] [ ] = [
129+ [ 2 , 2 , 5 ] , // div
130+ [ 2 , 6 , 20 ] , // class="header"
131+ [ 2 , 13 , 19 ] , // header
132+ [ 3 , 3 , 5 ] , // ul
133+ [ 3 , 6 , 22 ] , // class="nav main"
134+ [ 3 , 13 , 21 ] , // nav main
135+ [ 3 , 13 , 16 ] , // nav
136+ [ 3 , 17 , 21 ] , // main
137+ ] ;
138+ expectedNextItemPoints . forEach ( ( [ line , colstart , colend ] ) => {
139+ fetchSelectItem ( 'next' ) ;
140+ testSelection ( editor . selection , colstart , line , colend ) ;
141+ } ) ;
142+
143+ editor . selections = [ new Selection ( 4 , 1 , 4 , 1 ) ] ;
144+ expectedNextItemPoints . reverse ( ) . forEach ( ( [ line , colstart , colend ] ) => {
145+ fetchSelectItem ( 'prev' ) ;
146+ testSelection ( editor . selection , colstart , line , colend ) ;
147+ } ) ;
148+
149+ return Promise . resolve ( ) ;
150+ } ) ;
151+ } ) ;
152+
116153 test ( 'Emmet Select Next/Prev Item in css file' , function ( ) : any {
117154 return withRandomFileEditor ( cssContents , '.css' , ( editor , doc ) => {
118155 editor . selections = [ new Selection ( 0 , 0 , 0 , 0 ) ] ;
@@ -240,6 +277,42 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
240277 } ) ;
241278 } ) ;
242279
280+ test ( 'Emmet Balance In/Out in html template' , function ( ) : any {
281+ const htmlTemplate = `
282+ <script type="text/html">
283+ <div class="header">
284+ <ul class="nav main">
285+ <li class="item1">Item 1</li>
286+ <li class="item2">Item 2</li>
287+ </ul>
288+ </div>
289+ </script>` ;
290+
291+ return withRandomFileEditor ( htmlTemplate , 'html' , ( editor , doc ) => {
292+
293+ editor . selections = [ new Selection ( 5 , 24 , 5 , 24 ) ] ;
294+ let expectedBalanceOutRanges : [ number , number , number , number ] [ ] = [
295+ [ 5 , 20 , 5 , 26 ] , // <li class="item1">``Item 2''</li>
296+ [ 5 , 2 , 5 , 31 ] , // ``<li class="item1">Item 2</li>''
297+ [ 3 , 22 , 6 , 1 ] , // inner contents of ul
298+ [ 3 , 1 , 6 , 6 ] , // outer contents of ul
299+ [ 2 , 20 , 7 , 0 ] , // inner contents of div
300+ [ 2 , 0 , 7 , 6 ] , // outer contents of div
301+ ] ;
302+ expectedBalanceOutRanges . forEach ( ( [ linestart , colstart , lineend , colend ] ) => {
303+ balanceOut ( ) ;
304+ testSelection ( editor . selection , colstart , linestart , colend , lineend ) ;
305+ } ) ;
306+
307+ expectedBalanceOutRanges . pop ( ) ;
308+ expectedBalanceOutRanges . reverse ( ) . forEach ( ( [ linestart , colstart , lineend , colend ] ) => {
309+ balanceIn ( ) ;
310+ testSelection ( editor . selection , colstart , linestart , colend , lineend ) ;
311+ } ) ;
312+
313+ return Promise . resolve ( ) ;
314+ } ) ;
315+ } ) ;
243316} ) ;
244317
245318function testSelection ( selection : Selection , startChar : number , startline : number , endChar ?: number , endLine ?: number ) {
0 commit comments