|
|
|
@ -652,60 +652,6 @@ describe('StyleManager properties logic', () => { |
|
|
|
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', () => { |
|
|
|
compTypeProp.addLayer(); |
|
|
|
compTypeProp.clear(); |
|
|
|
@ -788,5 +734,59 @@ describe('StyleManager properties logic', () => { |
|
|
|
[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', |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|