@@ -10,6 +10,11 @@ import { style } from '../../../../src/style'
1010import { clearStore } from '../../helpers/clearStore'
1111import { store } from 'solid-logic'
1212
13+ const mockUpdater = store . updater as typeof store . updater & {
14+ updated : boolean
15+ reportSuccess : boolean
16+ }
17+
1318silenceDebugMessages ( )
1419afterEach ( clearStore )
1520
@@ -292,7 +297,7 @@ describe('basicField', () => {
292297 inputElement . value = 'changed value'
293298 const event = new Event ( 'change' )
294299 inputElement . dispatchEvent ( event )
295- expect ( store . updater . updated ) . toEqual ( true )
300+ expect ( mockUpdater . updated ) . toEqual ( true )
296301 } )
297302
298303 it ( 'defers date change while focused' , ( ) => {
@@ -441,7 +446,7 @@ describe('basicField', () => {
441446 inputElement . value = 'http://example.com/#changed-value'
442447 const event = new Event ( 'change' )
443448 inputElement . dispatchEvent ( event )
444- expect ( store . updater . updated ) . toEqual ( true )
449+ expect ( mockUpdater . updated ) . toEqual ( true )
445450 } )
446451
447452 it ( 'calls updater on change for a field with uriPrefix' , ( ) => {
@@ -470,7 +475,7 @@ describe('basicField', () => {
470475 inputElement . value = '999000'
471476 const event = new Event ( 'change' )
472477 inputElement . dispatchEvent ( event )
473- expect ( store . updater . updated ) . toEqual ( true )
478+ expect ( mockUpdater . updated ) . toEqual ( true )
474479 } )
475480
476481 it ( 'calls updater on change for a field with dt' , ( ) => {
@@ -484,7 +489,7 @@ describe('basicField', () => {
484489 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
485490 store . add ( form , ns . ui ( 'property' ) , property , doc )
486491 store . add ( form , ns . rdf ( 'type' ) , formType , doc )
487- store . add ( subject , property , 1.1111 , doc )
492+ store . add ( subject , property , lit ( ' 1.1111' ) , doc )
488493
489494 const result = basicField (
490495 document ,
@@ -499,7 +504,7 @@ describe('basicField', () => {
499504 inputElement . value = '9.99000'
500505 const event = new Event ( 'change' )
501506 inputElement . dispatchEvent ( event )
502- expect ( store . updater . updated ) . toEqual ( true )
507+ expect ( mockUpdater . updated ) . toEqual ( true )
503508 } )
504509
505510 it ( 'creates triple if missing' , ( ) => {
@@ -525,7 +530,7 @@ describe('basicField', () => {
525530 inputElement . value = '9.99000'
526531 const event = new Event ( 'change' )
527532 inputElement . dispatchEvent ( event )
528- expect ( store . updater . updated ) . toEqual ( true )
533+ expect ( mockUpdater . updated ) . toEqual ( true )
529534 } )
530535
531536 it ( 'Can update multiple docs' , ( ) => {
@@ -540,9 +545,9 @@ describe('basicField', () => {
540545 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
541546 store . add ( form , ns . ui ( 'property' ) , property , doc1 )
542547 store . add ( form , ns . rdf ( 'type' ) , formType , doc1 )
543- store . add ( subject , property , 1.1111 , doc1 )
544- store . add ( subject , property , 1.5 , doc1 )
545- store . add ( subject , property , 1.1111 , doc2 )
548+ store . add ( subject , property , lit ( ' 1.1111' ) , doc1 )
549+ store . add ( subject , property , lit ( ' 1.5' ) , doc1 )
550+ store . add ( subject , property , lit ( ' 1.1111' ) , doc2 )
546551
547552 const result = basicField (
548553 document ,
@@ -557,7 +562,7 @@ describe('basicField', () => {
557562 inputElement . value = '1.1111'
558563 const event = new Event ( 'change' )
559564 inputElement . dispatchEvent ( event )
560- expect ( store . updater . updated ) . toEqual ( true )
565+ expect ( mockUpdater . updated ) . toEqual ( true )
561566 } )
562567
563568 it ( 'Reports update success' , ( ) => {
@@ -569,7 +574,7 @@ describe('basicField', () => {
569574 const doc = namedNode ( 'http://example.com/' )
570575 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
571576 store . add ( form , ns . ui ( 'property' ) , property , doc )
572- store . add ( subject , property , 1.1111 , doc )
577+ store . add ( subject , property , lit ( ' 1.1111' ) , doc )
573578
574579 const result = basicField (
575580 document ,
@@ -583,7 +588,7 @@ describe('basicField', () => {
583588 const inputElement = result . childNodes [ 1 ] . childNodes [ 0 ] as HTMLInputElement
584589 inputElement . value = '1.1111'
585590 const event = new Event ( 'change' )
586- store . updater . reportSuccess = true
591+ mockUpdater . reportSuccess = true
587592 inputElement . dispatchEvent ( event )
588593 expect ( callbackFunction . mock . calls ) . toEqual ( [ [ true , 'body' ] ] )
589594 } )
@@ -597,7 +602,7 @@ describe('basicField', () => {
597602 const doc = namedNode ( 'http://example.com/' )
598603 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
599604 store . add ( form , ns . ui ( 'property' ) , property , doc )
600- store . add ( subject , property , 1.1111 , doc )
605+ store . add ( subject , property , lit ( ' 1.1111' ) , doc )
601606
602607 const result = basicField (
603608 document ,
@@ -611,7 +616,7 @@ describe('basicField', () => {
611616 const inputElement = result . childNodes [ 1 ] . childNodes [ 0 ] as HTMLInputElement
612617 inputElement . value = '1.1111'
613618 const event = new Event ( 'change' )
614- store . updater . reportSuccess = false
619+ mockUpdater . reportSuccess = false
615620 inputElement . dispatchEvent ( event )
616621 expect ( callbackFunction . mock . calls ) . toEqual ( [ [ false , 'body' ] ] )
617622 } )
@@ -626,8 +631,8 @@ describe('basicField', () => {
626631 const doc2 = namedNode ( 'http://example.com/2' )
627632 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
628633 store . add ( form , ns . ui ( 'property' ) , property , doc )
629- store . add ( subject , property , 1.1111 , doc )
630- store . add ( subject , property , 1.1111 , doc2 )
634+ store . add ( subject , property , lit ( ' 1.1111' ) , doc )
635+ store . add ( subject , property , lit ( ' 1.1111' ) , doc2 )
631636
632637 const result = basicField (
633638 document ,
@@ -641,7 +646,7 @@ describe('basicField', () => {
641646 const inputElement = result . childNodes [ 1 ] . childNodes [ 0 ] as HTMLInputElement
642647 inputElement . value = '1.1111'
643648 const event = new Event ( 'change' )
644- store . updater . reportSuccess = false
649+ mockUpdater . reportSuccess = false
645650 inputElement . dispatchEvent ( event )
646651 expect ( callbackFunction . mock . calls ) . toEqual ( [ [ false , 'body' ] ] )
647652 } )
@@ -856,7 +861,7 @@ describe('basicField', () => {
856861 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
857862 store . add ( form , ns . rdf ( 'type' ) , formType , doc )
858863 store . add ( form , ns . ui ( 'property' ) , property , doc )
859- store . add ( form , ns . ui ( 'size' ) , 30 , doc )
864+ store . add ( form , ns . ui ( 'size' ) , lit ( '30' ) , doc )
860865 store . add ( subject , property , namedNode ( 'tel:123412341234' ) , doc )
861866
862867 const result = basicField (
@@ -932,7 +937,7 @@ describe('basicField', () => {
932937 const doc = namedNode ( 'http://example.com/' )
933938 const callbackFunction = jest . fn ( ) // TODO: https://github.com/solidos/solid-ui/issues/263
934939 store . add ( form , ns . ui ( 'property' ) , property , doc )
935- store . add ( form , ns . ui ( 'maxLength' ) , 100 , doc )
940+ store . add ( form , ns . ui ( 'maxLength' ) , lit ( ' 100' ) , doc )
936941 store . add ( subject , property , namedNode ( 'tel:123412341234' ) , doc )
937942
938943 const result = basicField (
0 commit comments