Skip to content

Commit 47921de

Browse files
Handled Active Element of Table of Content (#2853)
* fix: Handled Active Eelement of Table of Content * fix: handled initial values of Context API. * fix:moved ContextAPI provider from dev-portal to elements-core * fix: handled initial values of contextAPI & implemented isActiveGroup Functionality * fix: updated the Unit test cases * fix: removed log * fix:added groupId & groupIndex in TableOfContents.stories.tsx * fix:removed onLickClick from handleClick * fix: optimise the updateTree functionality * fix: added parentId as 3rd property to identify the activeElement * fix: renamed the functionaliy to updateTocTree and removed logs. * fix: added useMemo to contextAPI. * fix: removed log * fix:implemented unique key approach for each Tree elements * fix: uncommented expect statement * fix: used '-' symbol as seperator in index unique key * fix: added types * chore(deps): bump up elements, elements-core & elements-dev-portal * Updated the resourse_class from xlarge to medium in the config.yml * .circleci config file modified * fix: added index property * fix: added all properties into single ContextAPI and removed 2nd ContextAPI. --------- Co-authored-by: Pankaj Yadav <pankaj.yadav@smartbear.com>
1 parent 621bcbc commit 47921de

11 files changed

Lines changed: 161 additions & 38 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
working_directory: /mnt/ramdisk/project
2626
docker:
2727
- image: cimg/node:18.20
28-
resource_class: xlarge
28+
resource_class: large
2929
environment:
3030
CYPRESS_CACHE_FOLDER: /mnt/ramdisk/.cache/Cypress
3131
YARN_CACHE_FOLDER: /mnt/ramdisk/.cache/yarn
@@ -47,7 +47,7 @@ jobs:
4747
- run: yarn build.docs
4848
run-e2e-tests:
4949
executor: cypress-default
50-
resource_class: xlarge
50+
resource_class: large
5151
working_directory: /mnt/ramdisk/project
5252
environment:
5353
CYPRESS_CACHE_FOLDER: /mnt/ramdisk/.cache/Cypress

packages/elements-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/elements-core",
3-
"version": "9.0.12",
3+
"version": "9.0.13",
44
"sideEffects": [
55
"web-components.min.js",
66
"src/web-components/**",

packages/elements-core/src/components/TableOfContents/TableOfContents.spec.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('TableOfContents', () => {
2727
slug: 'target',
2828
type: 'article',
2929
meta: '',
30+
index: '0-',
3031
},
3132
],
3233
},
@@ -55,6 +56,7 @@ describe('TableOfContents', () => {
5556
slug: 'target',
5657
type: 'article',
5758
meta: '',
59+
index: '0-',
5860
},
5961
],
6062
},
@@ -87,8 +89,10 @@ describe('TableOfContents', () => {
8789
slug: 'target',
8890
type: 'article',
8991
meta: '',
92+
index: '0-0-',
9093
},
9194
],
95+
index: '0-',
9296
},
9397
],
9498
},
@@ -119,6 +123,7 @@ describe('TableOfContents', () => {
119123
slug: 'target',
120124
type: 'article',
121125
meta: '',
126+
index: '0-',
122127
},
123128
],
124129
},
@@ -154,6 +159,7 @@ describe('TableOfContents', () => {
154159
slug: 'target',
155160
type: 'article',
156161
meta: '',
162+
index: '0-',
157163
},
158164
],
159165
},
@@ -191,6 +197,7 @@ describe('TableOfContents', () => {
191197
items: [],
192198
meta: '',
193199
version: '2',
200+
index: '0-',
194201
},
195202
{
196203
id: 'def',
@@ -199,6 +206,7 @@ describe('TableOfContents', () => {
199206
type: 'model',
200207
meta: '',
201208
version: '1.0.1',
209+
index: '1-',
202210
},
203211
{
204212
id: 'ghi',
@@ -207,6 +215,7 @@ describe('TableOfContents', () => {
207215
type: 'http_operation',
208216
meta: 'get',
209217
version: '1.0.2',
218+
index: '2-',
210219
},
211220
],
212221
},
@@ -238,13 +247,15 @@ describe('utils', () => {
238247
type: 'article',
239248
slug: 'abc-doc',
240249
meta: '',
250+
index: '0-',
241251
},
242252
{
243253
id: 'targetId',
244254
title: 'Target',
245255
slug: 'target',
246256
type: 'article',
247257
meta: '',
258+
index: '1-',
248259
},
249260
],
250261
},
@@ -258,6 +269,7 @@ describe('utils', () => {
258269
type: 'article',
259270
slug: 'abc-doc',
260271
meta: '',
272+
index: '0-',
261273
});
262274
});
263275

@@ -276,13 +288,15 @@ describe('utils', () => {
276288
slug: 'def-get-todo',
277289
type: 'http_operation',
278290
meta: 'get',
291+
index: '0-',
279292
},
280293
{
281294
id: 'ghi',
282295
title: 'Add Todo',
283296
slug: 'ghi-add-todo',
284297
type: 'http_operation',
285298
meta: 'post',
299+
index: '1-',
286300
},
287301
],
288302
},
@@ -295,6 +309,7 @@ describe('utils', () => {
295309
slug: 'def-get-todo',
296310
type: 'http_operation',
297311
meta: 'get',
312+
index: '0-',
298313
});
299314
});
300315
});

packages/elements-core/src/components/TableOfContents/TableOfContents.stories.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,59 @@ Playground.args = {
2727
title: 'Overview',
2828
type: 'overview',
2929
meta: '',
30+
index: '0-',
3031
},
3132
{
3233
title: 'Endpoints',
34+
index: '1-',
3335
},
3436
{
3537
id: '/operations/get-todos',
3638
slug: '/operations/get-todos',
3739
title: 'List Todos',
3840
type: 'http_operation',
3941
meta: 'get',
42+
index: '2-',
4043
},
4144
{
4245
id: '/operations/post-todos',
4346
slug: '/operations/post-todos',
4447
title: 'Create Todo',
4548
type: 'http_operation',
4649
meta: 'post',
50+
index: '3-',
4751
},
4852
{
4953
id: '/operations/get-todos-id',
5054
slug: '/operations/get-todos-id',
5155
title: 'Get Todo',
5256
type: 'http_operation',
5357
meta: 'get',
58+
index: '4-',
5459
},
5560
{
5661
id: '/operations/put-todos-id',
5762
slug: '/operations/put-todos-id',
5863
title: 'Replace Todo',
5964
type: 'http_operation',
6065
meta: 'put',
66+
index: '5-',
6167
},
6268
{
6369
id: '/operations/delete-todos-id',
6470
slug: '/operations/delete-todos-id',
6571
title: 'Delete Todo',
6672
type: 'http_operation',
6773
meta: 'delete',
74+
index: '6-',
6875
},
6976
{
7077
id: '/operations/patch-todos-id',
7178
slug: '/operations/patch-todos-id',
7279
title: 'Update Todo',
7380
type: 'http_operation',
7481
meta: 'patch',
82+
index: '7-',
7583
},
7684
{
7785
title: 'Users',
@@ -82,25 +90,30 @@ Playground.args = {
8290
title: 'Get User',
8391
type: 'http_operation',
8492
meta: 'get',
93+
index: '8-0-',
8594
},
8695
{
8796
id: '/operations/delete-users-userID',
8897
slug: '/operations/delete-users-userID',
8998
title: 'Delete User',
9099
type: 'http_operation',
91100
meta: 'delete',
101+
index: '8-1-',
92102
},
93103
{
94104
id: '/operations/post-users-userID',
95105
slug: '/operations/post-users-userID',
96106
title: 'Create User',
97107
type: 'http_operation',
98108
meta: 'post',
109+
index: '8-2-',
99110
},
100111
],
112+
index: '8-',
101113
},
102114
{
103115
title: 'Schemas',
116+
index: '9-',
104117
},
105118
{
106119
id: '/schemas/Todos',
@@ -109,13 +122,15 @@ Playground.args = {
109122
type: 'model',
110123
meta: '',
111124
version: '1.0.2',
125+
index: '10-',
112126
},
113127
{
114128
id: '/schemas/User',
115129
slug: '/schemas/User',
116130
title: 'User',
117131
type: 'model',
118132
meta: '',
133+
index: '11-',
119134
},
120135
],
121136
};

0 commit comments

Comments
 (0)