Browse Source

Up

pull/5694/head
Artur Arseniev 3 years ago
parent
commit
11c2e1bd44
  1. 108
      test/specs/style_manager/model/Properties.ts

108
test/specs/style_manager/model/Properties.ts

@ -652,60 +652,6 @@ describe('StyleManager properties logic', () => {
expect(rule1.getStyle()).toEqual({}); expect(rule1.getStyle()).toEqual({});
}); });
describe('emptyValue', () => {
test('Removing all layers with empty value as string', () => {
compTypeProp.set('emptyValue', 'unset'), compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propTest]: 'unset',
});
});
test('Removing all layers with empty value as string (detached)', () => {
compTypeProp.set('emptyValue', 'unset'), compTypeProp.set('detached', true);
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset',
[propBTest]: 'unset',
[propCTest]: 'unset',
});
});
test('Removing all layers with empty value as function', () => {
compTypeProp.set('emptyValue', () => ({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
})),
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
});
});
test('Removing all layers with empty value as function (detached)', () => {
compTypeProp.set('detached', true);
compTypeProp.set('emptyValue', () => ({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
[propCTest]: 'unset-c',
})),
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
[propCTest]: 'unset-c',
});
});
});
test('On clear removes all values', () => { test('On clear removes all values', () => {
compTypeProp.addLayer(); compTypeProp.addLayer();
compTypeProp.clear(); compTypeProp.clear();
@ -788,5 +734,59 @@ describe('StyleManager properties logic', () => {
[propCTest]: 'valueC-2-ext', [propCTest]: 'valueC-2-ext',
}); });
}); });
describe('emptyValue', () => {
test('Removing all layers with empty value as string', () => {
compTypeProp.set('emptyValue', 'unset'), compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propTest]: 'unset',
});
});
test('Removing all layers with empty value as string (detached)', () => {
compTypeProp.set('emptyValue', 'unset'), compTypeProp.set('detached', true);
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset',
[propBTest]: 'unset',
[propCTest]: 'unset',
});
});
test('Removing all layers with empty value as function', () => {
compTypeProp.set('emptyValue', () => ({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
})),
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
});
});
test('Removing all layers with empty value as function (detached)', () => {
compTypeProp.set('detached', true);
compTypeProp.set('emptyValue', () => ({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
[propCTest]: 'unset-c',
})),
compTypeProp.removeLayerAt(1);
compTypeProp.removeLayerAt(0);
expect(compTypeProp.getLayers().length).toBe(0);
expect(rule1.getStyle()).toEqual({
[propATest]: 'unset-a',
[propBTest]: 'unset-b',
[propCTest]: 'unset-c',
});
});
});
}); });
}); });

Loading…
Cancel
Save