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

Strings n things #3697

Merged
merged 3 commits into from
Sep 29, 2022
Merged
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 @@ -12,7 +12,7 @@
:value="accessibilityItem.value"
:label="accessibilityItem.label"
color="primary"
:data-test="`checkbox-${accessibilityItem.label}`"
:data-test="`checkbox-${accessibilityItem.help}`"
>
<template #label>
<span class="text-xs-left">{{ accessibilityItem.label }}</span>
Expand All @@ -22,7 +22,7 @@
:text="$tr(accessibilityItem.help)"
bottom
class="px-2"
:data-test="`tooltip-${accessibilityItem.label}`"
:data-test="`tooltip-${accessibilityItem.help}`"
/>
</template>
</Checkbox>
Expand Down Expand Up @@ -89,11 +89,11 @@
/**
* Strings for the help tooltips
*/
altText: `Alternative text is provided for visual content (e.g., via the HTML alt attribute).`,
audioDescription: `Audio descriptions are available (e.g., via an HTML5 track element with kind="descriptions")`,
highContrast: `Content meets the visual contrast threshold set out in WCAG Success Criteria 1.4.6`,
signLanguage: `Synchronized sign language intepretation is available for audio and video content.`,
taggedPdf: `The structures in a PDF have been tagged to improve the navigation of the content.`,
altText: `Visual elements in the resource have descriptions that can be accessed by screen readers for the benefit of blind learners`,
audioDescription: `The resource contains a second narration audio track that provides additional information for the benefit of blind users and those with low vision`,
highContrast: `The resource text and visual elements are displayed with high contrast for the benefit of users with low vision`,
signLanguage: `Synchronized sign language intepretation is available for audio and video content`,
taggedPdf: `The document contains PDF tags that can be accessed by screen readers for the benefit of blind learners`,
/* eslint-enable kolibri/vue-no-unused-translations */
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@
$trs: {
minutesRequired: 'Minutes',
optionalLabel:
'(Optional) Duration until resource is marked as complete. This value will not be shown to learners.',
'(Optional) Time required for the resource to be marked as completed. This value will not be displayed to learners.',
notOptionalLabel:
'Duration until resource is marked as complete. This value will not be shown to learners.',
'Time required for the resource to be marked as completed. This value will not be displayed to learners.',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,14 +870,14 @@
},
$trs: {
/* eslint-disable kolibri/vue-no-unused-translations */
allContent: 'All content viewed',
completeDuration: 'Complete duration',
determinedByResource: 'Determined by resource',
goal: 'Practice until goal is met',
allContent: 'Viewed in its entirety',
completeDuration: 'When time spent is equal to duration',
determinedByResource: 'Determined by the resource',
goal: 'When goal is met',
practiceQuiz: 'Practice quiz',
/* eslint-enable */
exactTime: 'Exact time to complete',
reference: 'Reference',
exactTime: 'Time to complete',
reference: 'Reference material',
referenceHint:
'Progress will not be tracked on reference material unless learners mark it as complete',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@
:required="isUnique(role)"
@focus="trackClick('Role visibility')"
/>

<!-- For Beginners -->
<KCheckbox
id="beginners"
ref="beginners"
:checked="forBeginners"
@change="value => forBeginners = value"
>
<span class="text-xs-left v-label" style="padding-left: 8px;">
{{ translateMetadataString('forBeginners') }}
</span>
</KCheckbox>
</VFlex>
</VLayout>

Expand Down Expand Up @@ -387,7 +399,12 @@
import VisibilityDropdown from 'shared/views/VisibilityDropdown';
import Checkbox from 'shared/views/form/Checkbox';
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
import { NEW_OBJECT, FeatureFlagKeys, AccessibilityCategories } from 'shared/constants';
import {
NEW_OBJECT,
FeatureFlagKeys,
AccessibilityCategories,
ResourcesNeededTypes,
} from 'shared/constants';
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins';

// Define an object to act as the place holder for non unique values.
Expand Down Expand Up @@ -568,6 +585,20 @@
accessibility: generateNestedNodesGetterSetter('accessibility_labels'),
contentLevel: generateNestedNodesGetterSetter('grade_levels'),
resourcesNeeded: generateNestedNodesGetterSetter('learner_needs'),
forBeginners: {
get() {
return this.resourcesNeeded.includes(ResourcesNeededTypes.FOR_BEGINNERS);
},
set(value) {
if (value) {
this.resourcesNeeded = [...this.resourcesNeeded, ResourcesNeededTypes.FOR_BEGINNERS];
} else {
this.resourcesNeeded = this.resourcesNeeded.filter(
r => r !== ResourcesNeededTypes.FOR_BEGINNERS
);
}
},
},
contentLearningActivities: generateNestedNodesGetterSetter('learning_activities'),
categories: generateNestedNodesGetterSetter('categories'),
license() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
clearable
:menu-props="{ offsetY: true, lazy: true, zIndex: 4 }"
:attach="$attrs.id ? `#${$attrs.id}` : '.resources-needed-container'"
:hint="hint"
persistent-hint
/>
</div>

Expand All @@ -23,27 +25,14 @@
import { ResourcesNeededTypes } from 'shared/constants';
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins';

/**
* @param {array} listOfKeys
* @returns {Object}
*
* Determines resources to show in the dropdown, to remove resources
* that do not currently need to be displayed in Kolibri
*/
export function updateResourcesDropdown(listOfKeys) {
if (listOfKeys) {
return Object.keys(ResourcesNeededTypes).reduce((acc, key) => {
if (listOfKeys.indexOf(key) === -1) {
acc[key] = ResourcesNeededTypes[key];
}
return acc;
}, {});
}
}

//the variable below can be changed or removed when metadata/Kolibri is updated
const keysToBeTemporarilyRemoved = ['PEERS', 'TEACHER', 'PRIOR_KNOWLEDGE', 'MATERIALS'];
const dropdown = updateResourcesDropdown(keysToBeTemporarilyRemoved) || ResourcesNeededTypes;
const dropdownItems = [
'PEERS',
'TEACHER',
'INTERNET',
'SPECIAL_SOFTWARE',
'PAPER_PENCIL',
'OTHER_SUPPLIES',
];

export default {
name: 'ResourcesNeededOptions',
Expand All @@ -64,14 +53,21 @@
},
},
resources() {
return Object.entries(dropdown).map(resource => ({
text: this.translateMetadataString(resource[0]),
value: resource[1],
return dropdownItems.map(key => ({
text: this.translateMetadataString(key),
value: ResourcesNeededTypes[key],
}));
},
hint() {
return this.value && this.value.includes(ResourcesNeededTypes.OTHER_SUPPLIES)
? this.$tr('furtherExplanation')
: '';
},
},
$trs: {
resourcesNeededLabel: 'What you will need',
resourcesNeededLabel: 'Requirements',
furtherExplanation:
"Please add to the 'Description' field any additional supplies learners will need in order to use this resource",
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ describe('AccessibilityOptions', () => {
},
});

expect(
wrapper.find('[data-test="checkbox-Has alternative text description for images"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="checkbox-Has high contrast display for low vision"]').exists()
).toBe(true);
expect(wrapper.find('[data-test="checkbox-Tagged PDF"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-Has sign language captions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has audio descriptions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-altText"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-highContrast"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-taggedPdf"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-signLanguage"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(false);
});

it('should display the correct list of accessibility options if resource is a video', () => {
Expand All @@ -40,17 +36,13 @@ describe('AccessibilityOptions', () => {
},
});

expect(
wrapper.find('[data-test="checkbox-Has alternative text description for images"]').exists()
).toBe(false);
expect(
wrapper.find('[data-test="checkbox-Has high contrast display for low vision"]').exists()
).toBe(false);
expect(wrapper.find('[data-test="checkbox-Tagged PDF"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has sign language captions"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-Has audio descriptions"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-Has captions or subtitles"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-Has captions or subtitles"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-altText"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-highContrast"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-taggedPdf"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-signLanguage"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-captionsSubtitles"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-captionsSubtitles"]').exists()).toBe(false);
});

it('should display the correct list of accessibility options if resource is an exercise/practice', () => {
Expand All @@ -60,15 +52,11 @@ describe('AccessibilityOptions', () => {
},
});

expect(
wrapper.find('[data-test="checkbox-Has alternative text description for images"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="checkbox-Has high contrast display for low vision"]').exists()
).toBe(false);
expect(wrapper.find('[data-test="checkbox-Tagged PDF"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has sign language captions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has audio descriptions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-altText"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-highContrast"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-taggedPdf"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-signLanguage"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(false);
});

it('should display the correct list of accessibility options if resource is html5/zip', () => {
Expand All @@ -78,15 +66,11 @@ describe('AccessibilityOptions', () => {
},
});

expect(
wrapper.find('[data-test="checkbox-Has alternative text description for images"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="checkbox-Has high contrast display for low vision"]').exists()
).toBe(true);
expect(wrapper.find('[data-test="checkbox-Tagged PDF"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has sign language captions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has audio descriptions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-altText"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-highContrast"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-taggedPdf"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-signLanguage"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(false);
});

it('should render appropriate tooltips along with the checkbox', () => {
Expand All @@ -96,23 +80,15 @@ describe('AccessibilityOptions', () => {
},
});

expect(
wrapper.find('[data-test="checkbox-Has alternative text description for images"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="tooltip-Has alternative text description for images"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="checkbox-Has high contrast display for low vision"]').exists()
).toBe(true);
expect(
wrapper.find('[data-test="tooltip-Has high contrast display for low vision"]').exists()
).toBe(true);
expect(wrapper.find('[data-test="checkbox-Tagged PDF"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-Tagged PDF"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-Has sign language captions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="tooltip-Has sign language captions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-Has audio descriptions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="tooltip-Has audio descriptions"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-altText"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-altText"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-highContrast"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-highContrast"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-taggedPdf"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-taggedPdf"]').exists()).toBe(true);
expect(wrapper.find('[data-test="checkbox-signLanguage"]').exists()).toBe(false);
expect(wrapper.find('[data-test="tooltip-signLanguage"]').exists()).toBe(false);
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(false);
expect(wrapper.find('[data-test="tooltip-audioDescription"]').exists()).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ describe('ActivityDuration', () => {

describe(`hints`, () => {
const optionalHint =
'(Optional) Duration until resource is marked as complete. This value will not be shown to learners.';
'(Optional) Time required for the resource to be marked as completed. This value will not be displayed to learners.';
const requiredHint =
'Duration until resource is marked as complete. This value will not be shown to learners.';
'Time required for the resource to be marked as completed. This value will not be displayed to learners.';
describe(`audio/video resource`, () => {
it(`should display optional hint when 'Short activity' is chosen`, () => {
const wrapper = shallowMount(ActivityDuration, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Vue from 'vue';
import Vuetify from 'vuetify';
import { shallowMount, mount } from '@vue/test-utils';
import ResourcesNeededOptions, { updateResourcesDropdown } from '../ResourcesNeededOptions.vue';
import { ResourcesNeededTypes } from 'shared/constants';
import ResourcesNeededOptions from '../ResourcesNeededOptions.vue';

Vue.use(Vuetify);

Expand All @@ -21,22 +20,6 @@ describe('ResourcesNeededOptions', () => {
expect(wrapper.isVueInstance()).toBe(true);
});

it('when there is a list of keys to remove from ResourcesNeededTypes, return updated map for ResourcesNeededTypes for dropdown', () => {
const list = ['FOR_BEGINNERS', 'INTERNET'];
const numberOfAvailableResources = Object.keys(ResourcesNeededTypes).length - list.length;
const dropdownItemsLength = Object.keys(updateResourcesDropdown(list)).length;

expect(dropdownItemsLength).toBe(numberOfAvailableResources);
});

it('when there are no keys to remove from ResourcesNeededTypes, dropdown should contain all resources', () => {
const list = [];
const numberOfAvailableResources = Object.keys(ResourcesNeededTypes).length - list.length;
const dropdownItemsLength = Object.keys(updateResourcesDropdown(list)).length;

expect(dropdownItemsLength).toBe(numberOfAvailableResources);
});

describe('updating state', () => {
it('should update resources field with new values received from a parent', () => {
const resourcesNeeded = ['person', 'book'];
Expand All @@ -53,7 +36,7 @@ describe('ResourcesNeededOptions', () => {

it('should emit new input values', () => {
const resourcesNeeded = ['person', 'book', 'train'];
const wrapper = makeWrapper({});
const wrapper = makeWrapper([]);
const dropdown = wrapper.find({ name: 'v-select' });
dropdown.vm.$emit('input', resourcesNeeded);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@
reviewMode: 'Review mode',
emptyChannelText: 'No resources found',
emptyChannelSubText:
'No changes to review! The channel contains all the latest folders and resources.',
'No changes to review! The channel contains all the most recent folders and resources.',
collapseAllButton: 'Collapse all',
openCurrentLocationButton: 'Jump to current folder location',
openCurrentLocationButton: 'Expand to current folder location',
totalResources: 'Total resources',
totalSize: 'Total size',
openSummaryDetailsDialogBtn: 'View summary',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
$trs: {
coachContent: 'Resources for coaches',
assessments: 'Assessments',
topicsHidden: 'No folders',
topicsHidden: 'Folders excluded',
createdAfter: "Added after '{date}'",
clearAll: 'Clear all',
},
Expand Down
Loading