@@ -50,6 +50,11 @@ describe('parse()', function () {
5050 expect ( element . type ) . to . equal ( 'messageTextElement' ) ;
5151 expect ( element ) . to . have . property ( 'value' ) ;
5252 expect ( element . value ) . to . equal ( msg ) ;
53+ expect ( element ) . to . have . property ( 'location' ) ;
54+ expect ( element . location ) . to . eql ( {
55+ start : { offset : 0 , line : 1 , column : 1 } ,
56+ end : { offset : 13 , line : 1 , column : 14 } ,
57+ } ) ;
5358 } ) ;
5459 } ) ;
5560
@@ -64,6 +69,11 @@ describe('parse()', function () {
6469 it ( 'should first contain a `messageTextElement`' , function ( ) {
6570 var element = ast . elements [ 0 ] ;
6671 expect ( element . value ) . to . equal ( 'Hello, ' ) ;
72+ expect ( element ) . to . have . property ( 'location' ) ;
73+ expect ( element . location ) . to . eql ( {
74+ start : { offset : 0 , line : 1 , column : 1 } ,
75+ end : { offset : 7 , line : 1 , column : 8 } ,
76+ } ) ;
6777 } ) ;
6878
6979 it ( 'should then contain an `argumentElement`' , function ( ) {
@@ -75,11 +85,21 @@ describe('parse()', function () {
7585 expect ( element . id ) . to . equal ( 'name' ) ;
7686 expect ( element ) . to . have . property ( 'format' ) ;
7787 expect ( element . format ) . to . equal ( null ) ;
88+ expect ( element ) . to . have . property ( 'location' ) ;
89+ expect ( element . location ) . to . eql ( {
90+ start : { offset : 7 , line : 1 , column : 8 } ,
91+ end : { offset : 13 , line : 1 , column : 14 } ,
92+ } ) ;
7893 } ) ;
7994
8095 it ( 'should finally contain a `messageTextElement`' , function ( ) {
8196 var element = ast . elements [ 2 ] ;
8297 expect ( element . value ) . to . equal ( '!' ) ;
98+ expect ( element ) . to . have . property ( 'location' ) ;
99+ expect ( element . location ) . to . eql ( {
100+ start : { offset : 13 , line : 1 , column : 14 } ,
101+ end : { offset : 14 , line : 1 , column : 15 } ,
102+ } ) ;
83103 } ) ;
84104 } ) ;
85105
@@ -98,6 +118,11 @@ describe('parse()', function () {
98118 expect ( element . type ) . to . equal ( 'argumentElement' ) ;
99119 expect ( element ) . to . have . property ( 'id' ) ;
100120 expect ( element . id ) . to . equal ( 'num' ) ;
121+ expect ( element ) . to . have . property ( 'location' ) ;
122+ expect ( element . location ) . to . eql ( {
123+ start : { offset : 0 , line : 1 , column : 1 } ,
124+ end : { offset : 22 , line : 1 , column : 23 } ,
125+ } ) ;
101126 expect ( element ) . to . have . property ( 'format' ) ;
102127
103128 var format = element . format ;
@@ -106,6 +131,11 @@ describe('parse()', function () {
106131 expect ( format . type ) . to . equal ( 'numberFormat' ) ;
107132 expect ( format ) . to . have . property ( 'style' ) ;
108133 expect ( format . style ) . to . equal ( 'percent' ) ;
134+ expect ( format ) . to . have . property ( 'location' ) ;
135+ expect ( format . location ) . to . eql ( {
136+ start : { offset : 6 , line : 1 , column : 7 } ,
137+ end : { offset : 21 , line : 1 , column : 22 } ,
138+ } ) ;
109139 } ) ;
110140 } ) ;
111141
@@ -124,6 +154,11 @@ describe('parse()', function () {
124154 expect ( element . type ) . to . equal ( 'argumentElement' ) ;
125155 expect ( element ) . to . have . property ( 'id' ) ;
126156 expect ( element . id ) . to . equal ( 'numPhotos' ) ;
157+ expect ( element ) . to . have . property ( 'location' ) ;
158+ expect ( element . location ) . to . eql ( {
159+ start : { offset : 0 , line : 1 , column : 1 } ,
160+ end : { offset : 64 , line : 1 , column : 65 } ,
161+ } ) ;
127162 expect ( element ) . to . have . property ( 'format' ) ;
128163
129164 var format = element . format ;
@@ -132,6 +167,11 @@ describe('parse()', function () {
132167 expect ( format . type ) . to . equal ( 'pluralFormat' ) ;
133168 expect ( format ) . to . have . property ( 'offset' ) ;
134169 expect ( format . offset ) . to . equal ( 0 ) ;
170+ expect ( format ) . to . have . property ( 'location' ) ;
171+ expect ( format . location ) . to . eql ( {
172+ start : { offset : 12 , line : 1 , column : 13 } ,
173+ end : { offset : 63 , line : 1 , column : 64 } ,
174+ } ) ;
135175 } ) ;
136176
137177 it ( 'should contain 3 `options`' , function ( ) {
@@ -146,6 +186,11 @@ describe('parse()', function () {
146186 expect ( option . selector ) . to . equal ( '=0' ) ;
147187 expect ( option ) . to . have . property ( 'value' ) ;
148188 expect ( option . value ) . to . be . an ( 'object' ) ;
189+ expect ( option ) . to . have . property ( 'location' ) ;
190+ expect ( option . location ) . to . eql ( {
191+ start : { offset : 20 , line : 1 , column : 21 } ,
192+ end : { offset : 33 , line : 1 , column : 34 } ,
193+ } ) ;
149194
150195 expect ( options [ 1 ] . selector ) . to . equal ( '=1' ) ;
151196 expect ( options [ 2 ] . selector ) . to . equal ( 'other' ) ;
@@ -167,6 +212,11 @@ describe('parse()', function () {
167212 expect ( element . type ) . to . equal ( 'messageTextElement' ) ;
168213 expect ( element ) . to . have . property ( 'value' ) ;
169214 expect ( element . value ) . to . equal ( 'no photos' ) ;
215+ expect ( element ) . to . have . property ( 'location' ) ;
216+ expect ( element . location ) . to . eql ( {
217+ start : { offset : 23 , line : 1 , column : 24 } ,
218+ end : { offset : 32 , line : 1 , column : 33 } ,
219+ } ) ;
170220
171221 expect ( options [ 1 ] . value . elements [ 0 ] . value ) . to . equal ( 'one photo' ) ;
172222 expect ( options [ 2 ] . value . elements [ 0 ] . value ) . to . equal ( '# photos' ) ;
@@ -188,6 +238,11 @@ describe('parse()', function () {
188238 expect ( element . type ) . to . equal ( 'argumentElement' ) ;
189239 expect ( element ) . to . have . property ( 'id' ) ;
190240 expect ( element . id ) . to . equal ( 'floor' ) ;
241+ expect ( element ) . to . have . property ( 'location' ) ;
242+ expect ( element . location ) . to . eql ( {
243+ start : { offset : 0 , line : 1 , column : 1 } ,
244+ end : { offset : 72 , line : 1 , column : 73 } ,
245+ } ) ;
191246 expect ( element ) . to . have . property ( 'format' ) ;
192247
193248 var format = element . format ;
@@ -197,6 +252,11 @@ describe('parse()', function () {
197252 expect ( format ) . to . have . property ( 'offset' ) ;
198253 expect ( format . offset ) . to . equal ( 0 ) ;
199254 expect ( format . ordinal ) . to . equal ( true ) ;
255+ expect ( format ) . to . have . property ( 'location' ) ;
256+ expect ( format . location ) . to . eql ( {
257+ start : { offset : 8 , line : 1 , column : 9 } ,
258+ end : { offset : 71 , line : 1 , column : 72 } ,
259+ } ) ;
200260 } ) ;
201261
202262 it ( 'should contain 5 `options`' , function ( ) {
@@ -211,6 +271,11 @@ describe('parse()', function () {
211271 expect ( option . selector ) . to . equal ( '=0' ) ;
212272 expect ( option ) . to . have . property ( 'value' ) ;
213273 expect ( option . value ) . to . be . an ( 'object' ) ;
274+ expect ( option ) . to . have . property ( 'location' ) ;
275+ expect ( option . location ) . to . eql ( {
276+ start : { offset : 23 , line : 1 , column : 24 } ,
277+ end : { offset : 33 , line : 1 , column : 34 } ,
278+ } ) ;
214279
215280 expect ( options [ 1 ] . selector ) . to . equal ( 'one' ) ;
216281 expect ( options [ 2 ] . selector ) . to . equal ( 'two' ) ;
@@ -234,6 +299,11 @@ describe('parse()', function () {
234299 expect ( element . type ) . to . equal ( 'messageTextElement' ) ;
235300 expect ( element ) . to . have . property ( 'value' ) ;
236301 expect ( element . value ) . to . equal ( 'ground' ) ;
302+ expect ( element ) . to . have . property ( 'location' ) ;
303+ expect ( element . location ) . to . eql ( {
304+ start : { offset : 26 , line : 1 , column : 27 } ,
305+ end : { offset : 32 , line : 1 , column : 33 } ,
306+ } ) ;
237307
238308 expect ( options [ 0 ] . value . elements [ 0 ] . value ) . to . equal ( 'ground' ) ;
239309 expect ( options [ 1 ] . value . elements [ 0 ] . value ) . to . equal ( '#st' ) ;
@@ -258,12 +328,22 @@ describe('parse()', function () {
258328 expect ( element . type ) . to . equal ( 'argumentElement' ) ;
259329 expect ( element ) . to . have . property ( 'id' ) ;
260330 expect ( element . id ) . to . equal ( 'gender' ) ;
331+ expect ( element ) . to . have . property ( 'location' ) ;
332+ expect ( element . location ) . to . eql ( {
333+ start : { offset : 0 , line : 1 , column : 1 } ,
334+ end : { offset : 58 , line : 1 , column : 59 } ,
335+ } ) ;
261336 expect ( element ) . to . have . property ( 'format' ) ;
262337
263338 var format = element . format ;
264339 expect ( format ) . to . be . an ( 'object' ) ;
265340 expect ( format ) . to . have . property ( 'type' ) ;
266341 expect ( format . type ) . to . equal ( 'selectFormat' ) ;
342+ expect ( format ) . to . have . property ( 'location' ) ;
343+ expect ( format . location ) . to . eql ( {
344+ start : { offset : 9 , line : 1 , column : 10 } ,
345+ end : { offset : 57 , line : 1 , column : 58 } ,
346+ } ) ;
267347 } ) ;
268348
269349 it ( 'should contain 3 `options`' , function ( ) {
@@ -278,6 +358,11 @@ describe('parse()', function () {
278358 expect ( option . selector ) . to . equal ( 'female' ) ;
279359 expect ( option ) . to . have . property ( 'value' ) ;
280360 expect ( option . value ) . to . be . an ( 'object' ) ;
361+ expect ( option ) . to . have . property ( 'location' ) ;
362+ expect ( option . location ) . to . eql ( {
363+ start : { offset : 17 , line : 1 , column : 18 } ,
364+ end : { offset : 31 , line : 1 , column : 32 } ,
365+ } ) ;
281366
282367 expect ( options [ 1 ] . selector ) . to . equal ( 'male' ) ;
283368 expect ( options [ 2 ] . selector ) . to . equal ( 'other' ) ;
@@ -299,6 +384,11 @@ describe('parse()', function () {
299384 expect ( element . type ) . to . equal ( 'messageTextElement' ) ;
300385 expect ( element ) . to . have . property ( 'value' ) ;
301386 expect ( element . value ) . to . equal ( 'woman' ) ;
387+ expect ( element ) . to . have . property ( 'location' ) ;
388+ expect ( element . location ) . to . eql ( {
389+ start : { offset : 25 , line : 1 , column : 26 } ,
390+ end : { offset : 30 , line : 1 , column : 31 } ,
391+ } ) ;
302392
303393 expect ( options [ 1 ] . value . elements [ 0 ] . value ) . to . equal ( 'man' ) ;
304394 expect ( options [ 2 ] . value . elements [ 0 ] . value ) . to . equal ( 'person' ) ;
0 commit comments