Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -48,8 +48,8 @@
icon: 'circleCheckmark',
},
[CommunityLibraryStatus.REJECTED]: {
text: 'Flagged',
tooltip: 'Review flagged submission',
text: 'Needs changes',
tooltip: 'Submission requires changes before approval',
color: theme.red.v_100,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these are admin-only so not translated, but I updated the langage here for consistency

darkColor: theme.red.v_200,
labelColor: theme.red.v_600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<component :is="showDraftMode ? 'KRadioButtonGroup' : 'div'">
<KRadioButton
v-if="showDraftMode"
:label="modeLive$()"
:label="publishChannelMode$()"
:buttonValue="PublishModes.LIVE"
:currentValue="mode"
:description="modeLiveDescription$()"
:description="publishChannelDescription$()"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

renamed for clarity

@input="mode = PublishModes.LIVE"
/>

Expand Down Expand Up @@ -53,7 +53,7 @@
showInvalidText
:label="versionDescriptionLabel$()"
:invalid="isVersionNotesBlurred && !isVersionNotesValid"
:invalidText="versionNotesRequiredMessage$()"
:invalidText="fieldRequired$()"
textArea
:maxlength="250"
:appearanceOverrides="{ maxWidth: 'none' }"
Expand All @@ -70,7 +70,7 @@
v-model="newChannelLanguage"
:label="languageLabel$()"
:invalid="isLanguageSelectBlurred && !isNewLanguageValid"
:invalidText="languageRequiredMessage$()"
:invalidText="fieldRequired$()"
:options="languageOptions"
@blur="isLanguageSelectBlurred = true"
/>
Expand Down Expand Up @@ -112,26 +112,17 @@
>
{{ incompleteResourcesDescription1$() }}
</div>
<div
class="warning-description"
:style="{
color: $themePalette.grey.v_800,
marginTop: '16px',
}"
>
{{ incompleteResourcesDescription2$() }}
</div>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed as unnecessary

</div>
</div>
</div>
</div>

<KRadioButton
v-if="showDraftMode"
:label="modeDraft$()"
:label="publishDraftMode$()"
:buttonValue="PublishModes.DRAFT"
:currentValue="mode"
:description="modeDraftDescription$()"
:description="publishDraftDescription$()"
@input="mode = PublishModes.DRAFT"
/>
</component>
Expand Down Expand Up @@ -166,6 +157,7 @@
import { Channel, CommunityLibrarySubmission } from 'shared/data/resources';
import { forceServerSync } from 'shared/data/serverSync';
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
import commonStrings from 'shared/translator';
import { LanguagesList } from 'shared/leUtils/Languages';
import logging from 'shared/logging';
import { FeatureFlagKeys } from 'shared/constants';
Expand Down Expand Up @@ -205,23 +197,22 @@
publishChannel$,
publishAction$,
saveDraft$,
modeLive$,
modeDraft$,
publishChannelMode$,
publishDraftMode$,
versionNotesLabel$,
modeLiveDescription$,
modeDraftDescription$,
publishChannelDescription$,
publishDraftDescription$,
publishingInfo$,
versionDescriptionLabel$,
incompleteResourcesWarning$,
incompleteResourcesDescription1$,
incompleteResourcesDescription2$,
cancelAction$,
languageLabel$,
languageRequiredMessage$,
draftBeingPublishedNotice$,
versionNotesRequiredMessage$,
} = communityChannelsStrings;

const { fieldRequired$ } = commonStrings;

const currentChannel = computed(() => store.getters['currentChannel/currentChannel']);
const getContentNode = computed(() => store.getters['contentNode/getContentNode']);
const areAllChangesSaved = computed(() => store.getters['areAllChangesSaved']);
Expand Down Expand Up @@ -416,21 +407,19 @@
isVersionNotesValid,
submitText,

modeLive$,
modeDraft$,
publishChannelMode$,
publishDraftMode$,
publishChannel$,
versionNotesLabel$,
modeLiveDescription$,
modeDraftDescription$,
publishChannelDescription$,
publishDraftDescription$,
publishingInfo$,
versionDescriptionLabel$,
incompleteResourcesWarning$,
incompleteResourcesDescription1$,
incompleteResourcesDescription2$,
cancelAction$,
languageLabel$,
languageRequiredMessage$,
versionNotesRequiredMessage$,
fieldRequired$,

onClose,
submit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jest.mock('shared/data/resources', () => ({

const store = factory();

const { nonePrimaryInfo$, flaggedPrimaryInfo$, approvedPrimaryInfo$, submittedPrimaryInfo$ } =
const { nonePrimaryInfo$, needsChangesPrimaryInfo$, approvedPrimaryInfo$ } =
communityChannelsStrings;

async function makeWrapper({ channel, publishedData, latestSubmission }) {
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('SubmitToCommunityLibrarySidePanel', () => {

const infoSection = wrapper.find('.info-section');
expect(infoSection.exists()).toBe(true);
expect(infoSection.text()).toContain(flaggedPrimaryInfo$());
expect(infoSection.text()).toContain(needsChangesPrimaryInfo$());
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

renamed the string as well for consistency

});

it('when the previous submission was approved', async () => {
Expand All @@ -219,7 +219,13 @@ describe('SubmitToCommunityLibrarySidePanel', () => {

const infoSection = wrapper.find('.info-section');
expect(infoSection.exists()).toBe(true);
expect(infoSection.text()).toContain(submittedPrimaryInfo$());
// PENDING status shows no primary info text — only the status chip
const infoText = wrapper.find('.info-text');
expect(infoText.text()).toBe('');
// Chip uses <script setup> with CSS v-bind (Vue 3 feature), so its text content is not
// available via VTU v1. Verify the chip is rendered with the correct status instead.
const statusChip = wrapper.findComponent(CommunityLibraryStatusChip);
expect(statusChip.exists()).toBe(true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
v-model="description"
:disabled="!canBeEdited"
:invalid="description.length < 1"
:invalidText="descriptionRequired$()"
:invalidText="fieldRequired$()"
textArea
:label="descriptionLabel$()"
:maxlength="250"
Expand Down Expand Up @@ -240,6 +240,7 @@
import { translateMetadataString } from 'shared/utils/metadataStringsTranslation';
import countriesUtil from 'shared/utils/countries';
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
import commonStrings from 'shared/translator';
import { CommunityLibrarySubmission } from 'shared/data/resources';

import SidePanelModal from 'shared/views/SidePanelModal';
Expand Down Expand Up @@ -276,7 +277,6 @@
lessDetailsButton$,
countryLabel$,
descriptionLabel$,
descriptionRequired$,
notPublishedWarningTitle$,
notPublishedWarningDescription$,
publicWarningTitle$,
Expand All @@ -285,9 +285,8 @@
alreadySubmittedWarningDescription$,
submitButton$,
cancelAction$,
submittedPrimaryInfo$,
approvedPrimaryInfo$,
flaggedPrimaryInfo$,
needsChangesPrimaryInfo$,
nonePrimaryInfo$,
channelVersion$,
submittedSnackbar$,
Expand All @@ -297,6 +296,8 @@
confirmReplacementText$,
} = communityChannelsStrings;

const { fieldRequired$ } = commonStrings;

const annotationColor = computed(() => tokensTheme.annotation);
const infoTextColor = computed(() => paletteTheme.grey.v_700);

Expand Down Expand Up @@ -343,17 +344,13 @@
if (!latestSubmissionIsFinished.value) return undefined;

switch (latestSubmissionStatus.value) {
case CommunityLibraryStatus.PENDING:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed as redundant

return {
primaryText: submittedPrimaryInfo$(),
};
case CommunityLibraryStatus.APPROVED:
return {
primaryText: approvedPrimaryInfo$(),
};
case CommunityLibraryStatus.REJECTED:
return {
primaryText: flaggedPrimaryInfo$(),
primaryText: needsChangesPrimaryInfo$(),
};
case null:
return {
Expand Down Expand Up @@ -572,7 +569,7 @@
lessDetailsButton$,
countryLabel$,
descriptionLabel$,
descriptionRequired$,
fieldRequired$,
channelVersion$,
notPublishedWarningTitle$,
notPublishedWarningDescription$,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PublishSidePanel from '../PublishSidePanel.vue';
import { Channel, CommunityLibrarySubmission } from 'shared/data/resources';
import { forceServerSync } from 'shared/data/serverSync';
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
import commonStrings from 'shared/translator';

const localVue = createLocalVue();
localVue.use(Vuex);
Expand Down Expand Up @@ -79,8 +80,10 @@ describe('PublishSidePanel', () => {
renderComponent();

// Headers and default texts
expect(screen.getByText(communityChannelsStrings.publishChannel$())).toBeVisible();
expect(screen.getByText(communityChannelsStrings.modeLive$())).toBeVisible();
expect(
screen.getByRole('heading', { name: communityChannelsStrings.publishChannel$() }),
).toBeVisible();
expect(screen.getAllByText(communityChannelsStrings.publishChannelMode$())[0]).toBeVisible();

expect(
screen.getByText(communityChannelsStrings.publishingInfo$({ version: 2 })),
Expand All @@ -89,8 +92,8 @@ describe('PublishSidePanel', () => {
// Default button text
expect(screen.getByText(communityChannelsStrings.publishAction$())).toBeVisible();

// Live mode selected by default
const liveRadio = screen.getByRole('radio', { name: /Live/ });
// Live mode selected by default (first radio in the group)
const [liveRadio] = screen.getAllByRole('radio');
expect(liveRadio).toBeChecked();
});

Expand All @@ -106,15 +109,15 @@ describe('PublishSidePanel', () => {

// Touch field to trigger validation visible
await fireEvent.blur(notesInput);
expect(screen.getByText('Version notes are required')).toBeVisible();
expect(screen.getByText(commonStrings.fieldRequired$())).toBeVisible();

// Type notes
await fireEvent.update(notesInput, 'My version notes');
await fireEvent.blur(notesInput);

// Validation error should disappear
await waitFor(() =>
expect(screen.queryByText('Version notes are required')).not.toBeInTheDocument(),
expect(screen.queryByText(commonStrings.fieldRequired$())).not.toBeInTheDocument(),
);
await waitFor(() => expect(publishBtn).toBeEnabled());
});
Expand Down
Loading
Loading