Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spec-renderer): tolowercase is not a function [KHCP-14300] #1833

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
v-for="section in sectionHeadings"
:key="section"
class="section-wrapper"
:data-testid="`spec-operations-list-section-${section.toLowerCase().replaceAll(' ', '-')}`"
:data-testid="`spec-operations-list-section-${String(section).toLowerCase().replaceAll(' ', '-')}`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this fixes? If section is undefined, you're going to be trimming a string of 'undefined'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be undefined as in sectionHeadings computed checks whether it's not falsy here:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so then why the need to wrap in String ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this error happened but it happened. I reworked my fix a bit

>
<KCollapse
:model-value="false"
Expand All @@ -41,7 +41,7 @@
<template #trigger="{ isCollapsed, toggle }">
<OperationsListSectionHeader
:content-element-id="getSectionContentId(section)"
:data-testid="`spec-operations-list-section-${section.toLowerCase().replaceAll(' ', '-')}-collapse-trigger`"
:data-testid="`spec-operations-list-section-${String(section).toLowerCase().replaceAll(' ', '-')}-collapse-trigger`"
:description="getSectionDescription(section)"
:is-collapsed="isCollapsed"
:name="section"
Expand Down Expand Up @@ -256,7 +256,7 @@ const isSelected = (item: OperationListItem): boolean => {
return !!s && s.path === item.path && s.method === item.method && s.operationId === item.operationId && s.tag === item.tag
}

const getSectionContentId = (section: string) => `${uid.value}-section-${section.toLowerCase()}`
const getSectionContentId = (section: string) => `${uid.value}-section-${String(section).toLowerCase()}`

const handleSelection = (item: OperationListItem) => {
if (!props.disableSelection) {
Expand Down
Loading