Skip to content

Commit 4604a4f

Browse files
TODO: test callbackFunctions
1 parent 7183dcd commit 4604a4f

1 file changed

Lines changed: 27 additions & 42 deletions

File tree

test/unit/widgets/forms.test.ts

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ import {
2626
sortBySequence
2727
} from '../../../src/widgets/forms'
2828

29-
// jest.mock('rdflib')
30-
// jest.mock('solid-auth-client')
31-
3229
describe('field', () => {
3330
it('exists', () => {
3431
expect(field).toBeInstanceOf(Object)
@@ -45,33 +42,21 @@ describe('Form field', () => {
4542
const subject = namedNode('http://example.com/#this')
4643
const form = namedNode('http://example.com/#form')
4744
const store = namedNode('http://example.com/#store')
48-
const callbackFunction = () => {}
45+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
4946

5047
// FIXME: https://github.com/solid/solid-ui/issues/239
5148
;(document as any).outlineManager = {
5249
appendPropertyTRs: () => {}
5350
}
54-
field[ns.ui('Form').uri](
51+
expect(field[ns.ui('Form').uri](
5552
document,
5653
container,
5754
already,
5855
subject,
5956
form,
6057
store,
6158
callbackFunction
62-
)
63-
64-
expect(
65-
field[ns.ui('Form').uri](
66-
document,
67-
container,
68-
already,
69-
subject,
70-
form,
71-
store,
72-
callbackFunction
73-
)
74-
).toMatchSnapshot()
59+
)).toMatchSnapshot()
7560
})
7661
// @@ TODO check this further what test could I use to make sure
7762
// to test that the form gets added but obviously not in the container passed in
@@ -82,7 +67,7 @@ describe('Form field', () => {
8267
const subject = namedNode('http://example.com/#this')
8368
const form = namedNode('http://example.com/#form')
8469
const store = namedNode('http://example.com/#store')
85-
const callbackFunction = () => {}
70+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
8671
expect(
8772
field[ns.ui('Form').uri](
8873
document,
@@ -103,7 +88,7 @@ describe('Form field', () => {
10388
const subject = dubSubject
10489
const form = namedNode('http://example.com/#form')
10590
const store = namedNode('http://example.com/#store')
106-
const callbackFunction = () => {}
91+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
10792
expect(
10893
field[ns.ui('Form').uri](
10994
document,
@@ -128,7 +113,7 @@ describe('Options field', () => {
128113
const subject = namedNode('http://example.com/#this')
129114
const form = namedNode('http://example.com/#form')
130115
const store = namedNode('http://example.com/#store')
131-
const callbackFunction = () => {}
116+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
132117
expect(
133118
field[ns.ui('Options').uri](
134119
document,
@@ -153,7 +138,7 @@ describe('Multiple field', () => {
153138
const subject = namedNode('http://example.com/#this')
154139
const form = namedNode('http://example.com/#form')
155140
const store = namedNode('http://example.com/#store')
156-
const callbackFunction = () => {}
141+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
157142
expect(
158143
field[ns.ui('Multiple').uri](
159144
document,
@@ -257,7 +242,7 @@ describe('PhoneField', () => {
257242
const form = namedNode('http://example.com/#form')
258243
uiStore.add(form, ns.ui('property'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
259244
const store = namedNode('http://example.com/#store')
260-
const callbackFunction = () => {}
245+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
261246
expect(
262247
field[ns.ui('PhoneField').uri](
263248
document,
@@ -282,7 +267,7 @@ describe('EmailField', () => {
282267
const subject = namedNode('http://example.com/#this')
283268
const form = namedNode('http://example.com/#form')
284269
const store = namedNode('http://example.com/#store')
285-
const callbackFunction = () => {}
270+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
286271
expect(
287272
field[ns.ui('EmailField').uri](
288273
document,
@@ -307,7 +292,7 @@ describe('ColorField', () => {
307292
const subject = namedNode('http://example.com/#this')
308293
const form = namedNode('http://example.com/#form')
309294
const store = namedNode('http://example.com/#store')
310-
const callbackFunction = () => {}
295+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
311296
expect(
312297
field[ns.ui('ColorField').uri](
313298
document,
@@ -332,7 +317,7 @@ describe('DateTimeField', () => {
332317
const subject = namedNode('http://example.com/#this')
333318
const form = namedNode('http://example.com/#form')
334319
const store = namedNode('http://example.com/#store')
335-
const callbackFunction = () => {}
320+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
336321
expect(
337322
field[ns.ui('DateTimeField').uri](
338323
document,
@@ -357,7 +342,7 @@ describe('TimeField', () => {
357342
const subject = namedNode('http://example.com/#this')
358343
const form = namedNode('http://example.com/#form')
359344
const store = namedNode('http://example.com/#store')
360-
const callbackFunction = () => {}
345+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
361346
expect(
362347
field[ns.ui('TimeField').uri](
363348
document,
@@ -382,7 +367,7 @@ describe('NumericField', () => {
382367
const subject = namedNode('http://example.com/#this')
383368
const form = namedNode('http://example.com/#form')
384369
const store = namedNode('http://example.com/#store')
385-
const callbackFunction = () => {}
370+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
386371
expect(
387372
field[ns.ui('NumericField').uri](
388373
document,
@@ -407,7 +392,7 @@ describe('IntegerField', () => {
407392
const subject = namedNode('http://example.com/#this')
408393
const form = namedNode('http://example.com/#form')
409394
const store = namedNode('http://example.com/#store')
410-
const callbackFunction = () => {}
395+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
411396
expect(
412397
field[ns.ui('IntegerField').uri](
413398
document,
@@ -432,7 +417,7 @@ describe('DecimalField', () => {
432417
const subject = namedNode('http://example.com/#this')
433418
const form = namedNode('http://example.com/#form')
434419
const store = namedNode('http://example.com/#store')
435-
const callbackFunction = () => {}
420+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
436421
expect(
437422
field[ns.ui('DecimalField').uri](
438423
document,
@@ -457,7 +442,7 @@ describe('FloatField]', () => {
457442
const subject = namedNode('http://example.com/#this')
458443
const form = namedNode('http://example.com/#form')
459444
const store = namedNode('http://example.com/#store')
460-
const callbackFunction = () => {}
445+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
461446
expect(
462447
field[ns.ui('FloatField').uri](
463448
document,
@@ -482,7 +467,7 @@ describe('TextField', () => {
482467
const subject = namedNode('http://example.com/#this')
483468
const form = namedNode('http://example.com/#form')
484469
const store = namedNode('http://example.com/#store')
485-
const callbackFunction = () => {}
470+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
486471
uiStore.add(form, ns.rdf('type'), namedNode('http://example.com/#type'), namedNode('http://example.com/'))
487472
uiStore.add(form, ns.ui('property'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
488473

@@ -510,7 +495,7 @@ describe('SingleLineTextField', () => {
510495
const subject = namedNode('http://example.com/#this')
511496
const form = namedNode('http://example.com/#form')
512497
const store = namedNode('http://example.com/#store')
513-
const callbackFunction = () => {}
498+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
514499
uiStore.add(form, ns.rdf('type'), namedNode('http://example.com/#type'), namedNode('http://example.com/'))
515500
uiStore.add(form, ns.ui('property'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
516501

@@ -538,7 +523,7 @@ describe('NamedNodeURIField', () => {
538523
const subject = namedNode('http://example.com/#this')
539524
const form = namedNode('http://example.com/#form')
540525
const store = namedNode('http://example.com/#store')
541-
const callbackFunction = () => {}
526+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
542527
uiStore.add(form, ns.rdf('type'), namedNode('http://example.com/#type'), namedNode('http://example.com/'))
543528
uiStore.add(form, ns.ui('property'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
544529

@@ -566,7 +551,7 @@ describe('MultiLineTextField', () => {
566551
const subject = namedNode('http://example.com/#this')
567552
const form = namedNode('http://example.com/#form')
568553
const store = namedNode('http://example.com/#store')
569-
const callbackFunction = () => {}
554+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
570555
expect(
571556
field[ns.ui('MultiLineTextField').uri](
572557
document,
@@ -591,7 +576,7 @@ describe('BooleanField', () => {
591576
const subject = namedNode('http://example.com/#this')
592577
const form = namedNode('http://example.com/#form')
593578
const store = namedNode('http://example.com/#store')
594-
const callbackFunction = () => {}
579+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
595580
expect(
596581
field[ns.ui('BooleanField').uri](
597582
document,
@@ -616,7 +601,7 @@ describe('TristateField', () => {
616601
const subject = namedNode('http://example.com/#this')
617602
const form = namedNode('http://example.com/#form')
618603
const store = namedNode('http://example.com/#store')
619-
const callbackFunction = () => {}
604+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
620605
expect(
621606
field[ns.ui('TristateField').uri](
622607
document,
@@ -643,7 +628,7 @@ describe('Classifier', () => {
643628
const store = namedNode('http://example.com/#store')
644629
uiStore.add(form, ns.ui('category'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
645630

646-
const callbackFunction = () => {}
631+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
647632
expect(
648633
field[ns.ui('Classifier').uri](
649634
document,
@@ -668,7 +653,7 @@ describe('Choice', () => {
668653
const subject = namedNode('http://example.com/#this')
669654
const form = namedNode('http://example.com/#form')
670655
const store = namedNode('http://example.com/#store')
671-
const callbackFunction = () => {}
656+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
672657
expect(
673658
field[ns.ui('Choice').uri](
674659
document,
@@ -700,7 +685,7 @@ describe('Heading', () => {
700685
const form = namedNode('http://example.com/#form')
701686
const store = namedNode('http://example.com/#store')
702687
uiStore.add(form, ns.ui('contents'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
703-
const callbackFunction = () => {}
688+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
704689
expect(
705690
field[ns.ui('Heading').uri](
706691
document,
@@ -725,7 +710,7 @@ describe('Comment', () => {
725710
const subject = namedNode('http://example.com/#this')
726711
const form = namedNode('http://example.com/#form')
727712
const store = namedNode('http://example.com/#store')
728-
const callbackFunction = () => {}
713+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
729714
uiStore.add(form, ns.ui('contents'), namedNode('http://example.com/#bla'), namedNode('http://example.com/'))
730715
expect(
731716
field[ns.ui('Comment').uri](
@@ -769,7 +754,7 @@ describe('editFormButton', () => {
769754
const container = null
770755
const form = null
771756
const store = namedNode('http://example.com/#store')
772-
const callbackFunction = () => {}
757+
const callbackFunction = jest.fn() // TODO: https://github.com/solid/solid-ui/issues/263
773758
expect(
774759
editFormButton(document, container, form, store, callbackFunction)
775760
).toBeInstanceOf(HTMLButtonElement)

0 commit comments

Comments
 (0)