@@ -18,14 +18,14 @@ it("renders empty with no schema", () => {
1818
1919it ( "renders empty with empty schema" , ( ) => {
2020 const div = document . createElement ( "div" ) ;
21- ReactDOM . render ( < Methods schema = { { } as any } /> , div ) ;
21+ ReactDOM . render ( < Methods schema = { { } as any } /> , div ) ;
2222 expect ( div . innerHTML ) . toBe ( "" ) ;
2323 ReactDOM . unmountComponentAtNode ( div ) ;
2424} ) ;
2525
2626it ( "renders empty with empty schema methods" , ( ) => {
2727 const div = document . createElement ( "div" ) ;
28- ReactDOM . render ( < Methods schema = { { methods : [ ] } as any } /> , div ) ;
28+ ReactDOM . render ( < Methods schema = { { methods : [ ] } as any } /> , div ) ;
2929 expect ( div . innerHTML ) . toBe ( "" ) ;
3030 ReactDOM . unmountComponentAtNode ( div ) ;
3131} ) ;
@@ -39,7 +39,7 @@ it("renders schema methods name", () => {
3939 } ,
4040 ] ,
4141 } ;
42- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
42+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
4343 expect ( div . innerHTML . includes ( "get_pet" ) ) . toBe ( true ) ;
4444 ReactDOM . unmountComponentAtNode ( div ) ;
4545} ) ;
@@ -60,6 +60,31 @@ it("doesnt renders collapsed contents", () => {
6060 ReactDOM . unmountComponentAtNode ( div ) ;
6161} ) ;
6262
63+ it ( "renders collapsed contents with defaultExpanded from uiSchema" , ( ) => {
64+ const div = document . createElement ( "div" ) ;
65+ const schema = {
66+ methods : [
67+ {
68+ params : [ {
69+ name : "foobarz" ,
70+ } ] ,
71+ } ,
72+ ] ,
73+ } ;
74+ const uiSchema = {
75+ links : {
76+ } ,
77+ methods : {
78+ "ui:defaultExpanded" : true ,
79+ } ,
80+ params : {
81+ } ,
82+ } ;
83+ ReactDOM . render ( < Methods uiSchema = { uiSchema } schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
84+ expect ( div . innerHTML . includes ( "aria-expanded=\"true\"" ) ) . toBe ( true ) ;
85+ ReactDOM . unmountComponentAtNode ( div ) ;
86+ } ) ;
87+
6388it ( "renders collapsed contents with disableTransitionProps" , ( ) => {
6489 const div = document . createElement ( "div" ) ;
6590 const schema = {
@@ -71,7 +96,7 @@ it("renders collapsed contents with disableTransitionProps", () => {
7196 } ,
7297 ] ,
7398 } ;
74- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
99+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
75100 expect ( div . innerHTML . includes ( "foobarz" ) ) . toBe ( true ) ;
76101 ReactDOM . unmountComponentAtNode ( div ) ;
77102} ) ;
@@ -93,7 +118,9 @@ it("renders schema plugin", () => {
93118 ) ;
94119 } ;
95120
96- ReactDOM . render ( < Methods schema = { schema as any } methodPlugins = { [ TestComponent ] } disableTransitionProps = { true } /> , div ) ;
121+ ReactDOM . render (
122+ < Methods schema = { schema as any } methodPlugins = { [ TestComponent ] } disableTransitionProps = { true } />
123+ , div ) ;
97124 expect ( div . innerHTML . includes ( "get_pet" ) ) . toBe ( true ) ;
98125 expect ( div . innerHTML . includes ( "Plugin Test" ) ) . toBe ( true ) ;
99126 ReactDOM . unmountComponentAtNode ( div ) ;
@@ -111,7 +138,7 @@ it("renders schema methods summary", () => {
111138 } ,
112139 ] ,
113140 } ;
114- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
141+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
115142 expect ( div . innerHTML . includes ( "a short summary" ) ) . toBe ( true ) ;
116143 ReactDOM . unmountComponentAtNode ( div ) ;
117144} ) ;
@@ -125,7 +152,7 @@ it("renders schema methods description", () => {
125152 } ,
126153 ] ,
127154 } as OpenRPC ;
128- ReactDOM . render ( < Methods schema = { schema } disableTransitionProps = { true } /> , div ) ;
155+ ReactDOM . render ( < Methods schema = { schema } disableTransitionProps = { true } /> , div ) ;
129156 expect ( div . innerHTML . includes ( "verbose get_pet description" ) ) . toBe ( true ) ;
130157 ReactDOM . unmountComponentAtNode ( div ) ;
131158} ) ;
@@ -141,7 +168,7 @@ it("renders schema methods params", () => {
141168 } ,
142169 ] ,
143170 } ;
144- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
171+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
145172 expect ( div . innerHTML . includes ( "foobarz" ) ) . toBe ( true ) ;
146173 ReactDOM . unmountComponentAtNode ( div ) ;
147174} ) ;
@@ -173,7 +200,7 @@ it("renders schema methods result", () => {
173200 } ,
174201 ] ,
175202 } ;
176- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
203+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
177204 expect ( div . innerHTML . includes ( "name" ) ) . toBe ( true ) ;
178205 expect ( div . innerHTML . includes ( "tag" ) ) . toBe ( true ) ;
179206 expect ( div . innerHTML . includes ( "id" ) ) . toBe ( true ) ;
@@ -245,7 +272,7 @@ it("renders schema methods tags", () => {
245272 } ,
246273 ] ,
247274 } ;
248- ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
275+ ReactDOM . render ( < Methods schema = { schema as any } disableTransitionProps = { true } /> , div ) ;
249276 expect ( div . innerHTML . includes ( "tag3" ) ) . toBe ( true ) ;
250277 expect ( div . innerHTML . includes ( "tag4" ) ) . toBe ( true ) ;
251278 expect ( div . innerHTML . includes ( "salad" ) ) . toBe ( true ) ;
0 commit comments