@@ -215,21 +215,30 @@ describe('Scope', () => {
215215
216216 it ( 'accepts an attribute value object with a unit' , ( ) => {
217217 const scope = new Scope ( ) ;
218- scope . setAttribute ( 'str' , { value : 1 , unit : 'ms ' } ) ;
218+ scope . setAttribute ( 'str' , { value : 1 , unit : 'millisecond ' } ) ;
219219 expect ( scope [ '_attributes' ] ) . toEqual ( {
220- str : { value : 1 , unit : 'ms' } ,
220+ str : { value : 1 , unit : 'millisecond' } ,
221+ } ) ;
222+ } ) ;
223+
224+ it ( 'accepts a custom unit' , ( ) => {
225+ // mostly there for type checking purposes.
226+ const scope = new Scope ( ) ;
227+ scope . setAttribute ( 'str' , { value : 3 , unit : 'inch' } ) ;
228+ expect ( scope [ '_attributes' ] ) . toEqual ( {
229+ str : { value : 3 , unit : 'inch' } ,
221230 } ) ;
222231 } ) ;
223232
224233 it ( 'accepts an array' , ( ) => {
225234 const scope = new Scope ( ) ;
226235
227236 scope . setAttribute ( 'strArray' , [ 'a' , 'b' , 'c' ] ) ;
228- scope . setAttribute ( 'intArray' , { value : [ 1 , 2 , 3 ] , unit : 'ms ' } ) ;
237+ scope . setAttribute ( 'intArray' , { value : [ 1 , 2 , 3 ] , unit : 'millisecond ' } ) ;
229238
230239 expect ( scope [ '_attributes' ] ) . toEqual ( {
231240 strArray : [ 'a' , 'b' , 'c' ] ,
232- intArray : { value : [ 1 , 2 , 3 ] , unit : 'ms ' } ,
241+ intArray : { value : [ 1 , 2 , 3 ] , unit : 'millisecond ' } ,
233242 } ) ;
234243 } ) ;
235244
@@ -266,23 +275,23 @@ describe('Scope', () => {
266275
267276 it ( 'accepts attribute value objects with units' , ( ) => {
268277 const scope = new Scope ( ) ;
269- scope . setAttributes ( { str : { value : 'b' , unit : 'ms ' } , int : { value : 12 , unit : 's ' } } ) ;
278+ scope . setAttributes ( { str : { value : 'b' , unit : 'millisecond ' } , int : { value : 12 , unit : 'second ' } } ) ;
270279 expect ( scope [ '_attributes' ] ) . toEqual ( {
271- str : { value : 'b' , unit : 'ms ' } ,
272- int : { value : 12 , unit : 's ' } ,
280+ str : { value : 'b' , unit : 'millisecond ' } ,
281+ int : { value : 12 , unit : 'second ' } ,
273282 } ) ;
274283 } ) ;
275284
276285 it ( 'accepts arrays' , ( ) => {
277286 const scope = new Scope ( ) ;
278287 scope . setAttributes ( {
279288 strArray : [ 'a' , 'b' , 'c' ] ,
280- intArray : { value : [ 1 , 2 , 3 ] , unit : 'ms ' } ,
289+ intArray : { value : [ 1 , 2 , 3 ] , unit : 'millisecond ' } ,
281290 } ) ;
282291
283292 expect ( scope [ '_attributes' ] ) . toEqual ( {
284293 strArray : [ 'a' , 'b' , 'c' ] ,
285- intArray : { value : [ 1 , 2 , 3 ] , unit : 'ms ' } ,
294+ intArray : { value : [ 1 , 2 , 3 ] , unit : 'millisecond ' } ,
286295 } ) ;
287296 } ) ;
288297
0 commit comments