Skip to content

Commit 12ace75

Browse files
added condition for empty title
1 parent 0da6530 commit 12ace75

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/frontend/src/pages/draft/Draft.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('Draft Component', () => {
130130
{ title: 'Section 2', content: 'Content of section 2.' }
131131
]
132132
},
133-
draftedDocumentTitle: '', // this must be explicitly ''
133+
draftedDocumentTitle: 'My Draft Title',
134134
}
135135
renderComponent(mockStateWithIncompleteLoad)
136136
await waitFor(() => {
@@ -152,7 +152,7 @@ describe('Draft Component', () => {
152152
{ title: 'Section 2', content: 'Content of section 2.' }
153153
]
154154
},
155-
draftedDocumentTitle: '', // critical for button to be enabled
155+
draftedDocumentTitle: 'My Draft Title',
156156
}
157157
renderComponent(mockStateWithIncompleteLoad)
158158

@@ -251,7 +251,7 @@ describe('Draft Component', () => {
251251
{ title: 'Section 2', content: 'Content of section 2.' }
252252
]
253253
},
254-
draftedDocumentTitle: '', // must be empty string
254+
draftedDocumentTitle: 'My Draft Title',
255255
}
256256
renderComponent(mockStateWithIncompleteLoad)
257257

@@ -280,7 +280,7 @@ describe('Draft Component', () => {
280280
{ title: 'Section 2', content: 'Content of section 2.' }
281281
]
282282
},
283-
draftedDocumentTitle: null // allow null here
283+
draftedDocumentTitle: 'My Draft Title', // title should not be null
284284
}
285285
renderComponent(mockStateWithIncompleteLoad)
286286
await waitFor(async () => {

src/frontend/src/pages/draft/Draft.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Draft = (): JSX.Element => {
5050

5151
useEffect(() => {
5252
const title = draftedDocumentTitle ?? '' // Normalize null to ''
53-
if (isLoadedSections?.length === sections.length && title === '') {
53+
if (isLoadedSections?.length === sections.length && title.length > 0) {
5454
setIsExportButtonDisable(false);
5555
}
5656
else {

0 commit comments

Comments
 (0)