feat: Replace rtlMixin to a composable (#9924)
This PR will replace the usage of `rtlMixin` to the `useUISettings` composable, and moved the method to component itself.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getters } from '../../accounts';
|
||||
import * as languageHelpers from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||
|
||||
const accountData = {
|
||||
id: 1,
|
||||
@@ -46,4 +47,37 @@ describe('#getters', () => {
|
||||
)(1, 'auto_resolve_conversations')
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
describe('isRTL', () => {
|
||||
it('returns false when accountId is not present', () => {
|
||||
const rootState = { route: { params: {} } };
|
||||
expect(getters.isRTL({}, null, rootState)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true for RTL language', () => {
|
||||
const state = {
|
||||
records: [{ id: 1, locale: 'ar' }],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
vi.spyOn(languageHelpers, 'getLanguageDirection').mockReturnValue(true);
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for LTR language', () => {
|
||||
const state = {
|
||||
records: [{ id: 1, locale: 'en' }],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
vi.spyOn(languageHelpers, 'getLanguageDirection').mockReturnValue(false);
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false when account is not found', () => {
|
||||
const state = {
|
||||
records: [],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user