color-scheme
Version:
Generate pleasant color schemes
77 lines (71 loc) • 2.17 kB
JavaScript
// Generated by CoffeeScript 1.7.1
var ColorScheme, chai;
chai = require('chai');
chai.should();
ColorScheme = require('../src/lib/color-scheme');
describe('ColorScheme class', function() {
describe('SCHEMES Object', function() {
it('should exist', function() {
return ColorScheme.SCHEMES.should.exist;
});
it('should be an object', function() {
return ColorScheme.SCHEMES.should.be.a('object');
});
it('should have property for "mono"', function() {
return ColorScheme.SCHEMES.mono.should.exist;
});
return it('should have property for "contrast"', function() {
return ColorScheme.SCHEMES.contrast.should.exist;
});
});
describe('PRESETS object', function() {
it('should exist', function() {
return ColorScheme.PRESETS.should.exist;
});
return it('should have a property for "default"', function() {
return ColorScheme.PRESETS["default"].should.exist;
});
});
describe('COLOR_WHEEL object', function() {
return it('should exist', function() {
return ColorScheme.COLOR_WHEEL.should.exist;
});
});
return describe('scheme()', function() {
var s;
s = null;
beforeEach(function() {
return s = new ColorScheme;
});
it('should not throw with no argument', function() {
return (function() {
return s.scheme();
}).should.not["throw"]();
});
return it('should return the current scheme', function() {
var ret;
s.scheme('mono');
ret = s.scheme();
ret.should.equal('mono');
return ret.should.equal(s._scheme);
});
});
});
describe('ColorScheme instance', function() {
var scheme;
scheme = new ColorScheme;
it('should be a ColorScheme object', function() {
return scheme.should.be instanceof ColorScheme;
});
it('should have a working from_hex() method', function() {
return (function() {
return scheme.from_hex('ff0000');
}).should.not.Throw();
});
return it(' from_hex() should not throw with ', function() {
return (function() {
scheme.from_hex('ad1457');
return scheme.from_hex('790001');
}).should.not.Throw();
});
});