Chore: Test coverage hunt (#36)
* chore: add brand mocking in gallery view * feat: dev gallery app * chore: link mock block ids to real block type api * feat: image settings page features * chore: more tests * chore: keystore util and more testing * chore: more tests * chore: re-install lint plugin... * chore: lint fixes * chore: moar tests * chore: remove brand from module.config and link gallery to edx.org brand
This commit is contained in:
@@ -87,7 +87,7 @@ export const dimensionLockHooks = () => {
|
||||
|
||||
const initializeLock = ({ width, height }) => {
|
||||
// find minimum viable increment
|
||||
let gcd = findGcd(width, height);
|
||||
let gcd = module.findGcd(width, height);
|
||||
if ([width, height].some(v => !Number.isInteger(v / gcd))) {
|
||||
gcd = 1;
|
||||
}
|
||||
|
||||
@@ -135,6 +135,11 @@ describe('ImageSettingsModal hooks', () => {
|
||||
hook.initializeLock(multiDims);
|
||||
expect(state.setState.lockDims).toHaveBeenCalledWith(reducedDims);
|
||||
});
|
||||
it('returns the values themselves if they have no gcd', () => {
|
||||
jest.spyOn(hooks, hookKeys.findGcd).mockReturnValueOnce(2);
|
||||
hook.initializeLock(simpleDims);
|
||||
expect(state.setState.lockDims).toHaveBeenCalledWith(simpleDims);
|
||||
});
|
||||
});
|
||||
test('lock sets isLocked to true', () => {
|
||||
hook = hooks.dimensionLockHooks({ dimensions: simpleDims });
|
||||
@@ -280,4 +285,12 @@ describe('ImageSettingsModal hooks', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('isSaveDisabled', () => {
|
||||
it('returns true iff is not decorative and altText value is empty', () => {
|
||||
hook = hooks.isSaveDisabled;
|
||||
expect(hook({ isDecorative: false, value: '' })).toEqual(true);
|
||||
expect(hook({ isDecorative: false, value: 'test' })).toEqual(false);
|
||||
expect(hook({ isDecorative: true, value: '' })).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user