File tree 2 files changed +32
-32
lines changed
2 files changed +32
-32
lines changed Original file line number Diff line number Diff line change @@ -88,32 +88,6 @@ describe('SchemaField', () => {
88
88
globalUiOptions : { copyable : true } ,
89
89
} ) ;
90
90
} ) ;
91
- it ( 'should provide expected registry with field option first' , ( ) => {
92
- let receivedProps ;
93
- const schema = {
94
- type : 'object' ,
95
- properties : {
96
- a : { type : 'string' } ,
97
- } ,
98
- } ;
99
-
100
- createFormComponent ( {
101
- schema,
102
- uiSchema : {
103
- 'ui:globalOptions' : { readonly : true } ,
104
- a : {
105
- 'ui:readonly' : false ,
106
- 'ui:widget' : ( props ) => {
107
- receivedProps = props ;
108
- return null ;
109
- } ,
110
- } ,
111
- } ,
112
- } ) ;
113
-
114
- const { readonly } = receivedProps ;
115
- expect ( readonly ) . eql ( false ) ;
116
- } ) ;
117
91
} ) ;
118
92
119
93
describe ( 'Unsupported field' , ( ) => {
Original file line number Diff line number Diff line change @@ -2505,9 +2505,7 @@ describe('uiSchema', () => {
2505
2505
} ) ;
2506
2506
2507
2507
describe ( 'ObjectField' , ( ) => {
2508
- let node ;
2509
-
2510
- beforeEach ( ( ) => {
2508
+ it ( 'should mark as readonly an ObjectField' , ( ) => {
2511
2509
const schema = {
2512
2510
type : 'object' ,
2513
2511
properties : {
@@ -2523,13 +2521,41 @@ describe('uiSchema', () => {
2523
2521
const uiSchema = { } ;
2524
2522
2525
2523
let rendered = createFormComponent ( { schema, uiSchema } ) ;
2526
- node = rendered . node ;
2527
- } ) ;
2524
+ const node = rendered . node ;
2528
2525
2529
- it ( 'should mark as readonly an ObjectField' , ( ) => {
2530
2526
const disabled = [ ] . map . call ( node . querySelectorAll ( '[type=text]' ) , ( node ) => node . hasAttribute ( 'readonly' ) ) ;
2531
2527
expect ( disabled ) . eql ( [ true , true ] ) ;
2532
2528
} ) ;
2529
+
2530
+ it ( 'should not mark as readonly even if globalOptions set readonly' , ( ) => {
2531
+ const schema = {
2532
+ type : 'object' ,
2533
+ properties : {
2534
+ foo : {
2535
+ type : 'string' ,
2536
+ } ,
2537
+ bar : {
2538
+ type : 'string' ,
2539
+ } ,
2540
+ } ,
2541
+ readOnly : true ,
2542
+ } ;
2543
+
2544
+ const uiSchema = {
2545
+ 'ui:globalOptions' : {
2546
+ readonly : true ,
2547
+ } ,
2548
+ foo : {
2549
+ 'ui:readonly' : false ,
2550
+ } ,
2551
+ } ;
2552
+
2553
+ let rendered = createFormComponent ( { schema, uiSchema } ) ;
2554
+ const node = rendered . node ;
2555
+
2556
+ const disabled = [ ] . map . call ( node . querySelectorAll ( '[type=text]' ) , ( node ) => node . hasAttribute ( 'readonly' ) ) ;
2557
+ expect ( disabled ) . eql ( [ false , true ] ) ;
2558
+ } ) ;
2533
2559
} ) ;
2534
2560
} ) ;
2535
2561
You can’t perform that action at this time.
0 commit comments