Color / add an isStringColor utility function
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
asArray,
|
||||
asString,
|
||||
fromString,
|
||||
isStringColor,
|
||||
normalize,
|
||||
toString
|
||||
} from '../../../src/ol/color.js';
|
||||
@@ -159,4 +160,18 @@ describe('ol.color', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('isValid()', function() {
|
||||
|
||||
it('correctly detects valid colors', function() {
|
||||
expect(isStringColor('rgba(1,3,4,0.4)')).to.be(true);
|
||||
expect(isStringColor('rgb(1,3,4)')).to.be(true);
|
||||
expect(isStringColor('lightgreen')).to.be(true);
|
||||
expect(isStringColor('yellow')).to.be(true);
|
||||
expect(isStringColor('GREEN')).to.be(true);
|
||||
expect(isStringColor('notacolor')).to.be(false);
|
||||
expect(isStringColor('red_')).to.be(false);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user