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

AnMi: Replaced KResponsiveWindow mixin by useKResponsiveWindow compos… #11346

Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -39,7 +39,6 @@
import { mapState } from 'vuex';
import pickBy from 'lodash/pickBy';
import debounce from 'lodash/debounce';
import responsiveWindowMixin from 'kolibri.coreVue.mixins.responsiveWindowMixin';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import FilterTextbox from 'kolibri.coreVue.components.FilterTextbox';
import UserTable from 'kolibri.coreVue.components.UserTable';
Expand All @@ -54,7 +53,7 @@
UserTable,
FilterTextbox,
},
mixins: [commonCoreStrings, responsiveWindowMixin],
mixins: [commonCoreStrings],
props: {
pageType: {
type: String,
Expand Down
8 changes: 6 additions & 2 deletions kolibri/plugins/facility/assets/src/views/DataPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
import urls from 'kolibri.urls';
import { FacilityResource } from 'kolibri.resources';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import KResponsiveWindowMixin from 'kolibri-design-system/lib/KResponsiveWindowMixin';
import useKResponsiveWindow from 'kolibri-design-system/lib/useKResponsiveWindow';
import validationConstants from 'kolibri-design-system/lib/KDateRange/validationConstants';
import { currentLanguage } from 'kolibri.utils.i18n';
import { now } from 'kolibri.utils.serverClock';
Expand Down Expand Up @@ -218,7 +218,11 @@
LearnMoreModal,
KDateRange,
},
mixins: [commonCoreStrings, KResponsiveWindowMixin],
mixins: [commonCoreStrings],
setup() {
const { windowIsLarge, windowIsSmall } = useKResponsiveWindow();
return { windowIsLarge, windowIsSmall };
rtibbles marked this conversation as resolved.
Show resolved Hide resolved
},
data() {
return {
showLearnMoreSummaryModal: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
<script>

import { mapActions, mapGetters, mapState } from 'vuex';
import responsiveWindowMixin from 'kolibri.coreVue.mixins.responsiveWindowMixin';
import useKResponsiveWindow from 'kolibri.coreVue.composables.useKResponsiveWindow';
import { createTranslator } from 'kolibri.utils.i18n';

import camelCase from 'lodash/camelCase';
Expand Down Expand Up @@ -273,7 +273,11 @@
ChangePinModal,
RemovePinModal,
},
mixins: [commonCoreStrings, responsiveWindowMixin],
mixins: [commonCoreStrings],
setup() {
const { windowIsSmall } = useKResponsiveWindow();
return { windowIsSmall };
},
data() {
return {
showModal: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@

import CoreInfoIcon from 'kolibri.coreVue.components.CoreInfoIcon';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import responsiveWindowMixin from 'kolibri.coreVue.mixins.responsiveWindowMixin';
import useKResponsiveWindow from 'kolibri.coreVue.composables.useKResponsiveWindow';

export default {
name: 'IdentifierTextbox',
components: {
CoreInfoIcon,
},
mixins: [commonCoreStrings, responsiveWindowMixin],
mixins: [commonCoreStrings],
setup() {
const { windowIsSmall } = useKResponsiveWindow();
return { windowIsSmall };
},
props: {
value: {
type: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { mount } from '@vue/test-utils';
import useKResponsiveWindow from 'kolibri-design-system/lib/useKResponsiveWindow';
import ConfigPage from '../../src/views/FacilityConfigPage';
import makeStore from '../makeStore';

jest.mock('kolibri-design-system/lib/useKResponsiveWindow');
jest.mock('../../../../device/assets/src/views/DeviceSettingsPage/api.js', () => ({
getDeviceSettings: jest.fn(),
}));
Expand Down Expand Up @@ -31,6 +33,12 @@ function getElements(wrapper) {
}

describe('facility config page view', () => {
beforeAll(() => {
useKResponsiveWindow.mockImplementation(() => ({
windowIsSmall: false,
}));
});

function assertModalIsUp(wrapper) {
const { confirmResetModal } = getElements(wrapper);
expect(confirmResetModal().exists()).toEqual(true);
Expand Down