mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add npm and minified builds
This commit is contained in:
@ -1,110 +1,110 @@
|
||||
var Color = require('../../src/color');
|
||||
var assert = require('assert');
|
||||
const Color = require('../../dist/npm/Color').default;
|
||||
const assert = require('assert');
|
||||
|
||||
describe('Colors', function() {
|
||||
describe('named colors', function() {
|
||||
it('bisque', function() {
|
||||
var c = new Color('bisque');
|
||||
describe('Colors', () => {
|
||||
describe('named colors', () => {
|
||||
it('bisque', () => {
|
||||
const c = new Color('bisque');
|
||||
assertColor(c, 255, 228, 196, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('BLUE', function() {
|
||||
var c = new Color('BLUE');
|
||||
it('BLUE', () => {
|
||||
const c = new Color('BLUE');
|
||||
assertColor(c, 0, 0, 255, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rgb()', function() {
|
||||
it('rgb(1,3,5)', function() {
|
||||
var c = new Color('rgb(1,3,5)');
|
||||
describe('rgb()', () => {
|
||||
it('rgb(1,3,5)', () => {
|
||||
const c = new Color('rgb(1,3,5)');
|
||||
assertColor(c, 1, 3, 5, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('rgb(222, 111, 50)', function() {
|
||||
var c = new Color('rgb(222, 111, 50)');
|
||||
it('rgb(222, 111, 50)', () => {
|
||||
const c = new Color('rgb(222, 111, 50)');
|
||||
assertColor(c, 222, 111, 50, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('rgb( 222, 111 , 50)', function() {
|
||||
var c = new Color('rgb(222 , 111 , 50)');
|
||||
it('rgb( 222, 111 , 50)', () => {
|
||||
const c = new Color('rgb(222 , 111 , 50)');
|
||||
assertColor(c, 222, 111, 50, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('rgba()', function() {
|
||||
it('rgba(200,3,5,1)', function() {
|
||||
var c = new Color('rgba(200,3,5,1)');
|
||||
describe('rgba()', () => {
|
||||
it('rgba(200,3,5,1)', () => {
|
||||
const c = new Color('rgba(200,3,5,1)');
|
||||
assertColor(c, 200, 3, 5, 1);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('rgba(222, 111, 50, 0.22)', function() {
|
||||
var c = new Color('rgba(222, 111, 50, 0.22)');
|
||||
it('rgba(222, 111, 50, 0.22)', () => {
|
||||
const c = new Color('rgba(222, 111, 50, 0.22)');
|
||||
assertColor(c, 222, 111, 50, 0.22);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('rgba( 222, 111 , 50, 0.123 )', function() {
|
||||
var c = new Color('rgba(222 , 111 , 50, 0.123)');
|
||||
it('rgba( 222, 111 , 50, 0.123 )', () => {
|
||||
const c = new Color('rgba(222 , 111 , 50, 0.123)');
|
||||
assertColor(c, 222, 111, 50, 0.123);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hex', function() {
|
||||
it('#7FFFD4', function() {
|
||||
var c = new Color('#7FFFD4');
|
||||
describe('hex', () => {
|
||||
it('#7FFFD4', () => {
|
||||
const c = new Color('#7FFFD4');
|
||||
assertColor(c, 127, 255, 212, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('#f0ffff', function() {
|
||||
var c = new Color('#f0ffff');
|
||||
it('#f0ffff', () => {
|
||||
const c = new Color('#f0ffff');
|
||||
assertColor(c, 240, 255, 255, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('#fff', function() {
|
||||
var c = new Color('#fff');
|
||||
it('#fff', () => {
|
||||
const c = new Color('#fff');
|
||||
assertColor(c, 255, 255, 255, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('from array', function() {
|
||||
it('[1,2,3]', function() {
|
||||
var c = new Color([1, 2, 3]);
|
||||
describe('from array', () => {
|
||||
it('[1,2,3]', () => {
|
||||
const c = new Color([1, 2, 3]);
|
||||
assertColor(c, 1, 2, 3, null);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('[5,6,7,1]', function() {
|
||||
var c = new Color([5, 6, 7, 1]);
|
||||
it('[5,6,7,1]', () => {
|
||||
const c = new Color([5, 6, 7, 1]);
|
||||
assertColor(c, 5, 6, 7, 1);
|
||||
assert.equal(c.isTransparent(), false);
|
||||
});
|
||||
|
||||
it('[5,6,7,0]', function() {
|
||||
var c = new Color([5, 6, 7, 0]);
|
||||
it('[5,6,7,0]', () => {
|
||||
const c = new Color([5, 6, 7, 0]);
|
||||
assertColor(c, 5, 6, 7, 0);
|
||||
assert.equal(c.isTransparent(), true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('transparency', function() {
|
||||
it('transparent', function() {
|
||||
var c = new Color('transparent');
|
||||
describe('transparency', () => {
|
||||
it('transparent', () => {
|
||||
const c = new Color('transparent');
|
||||
assertColor(c, 0, 0, 0, 0);
|
||||
assert.equal(c.isTransparent(), true);
|
||||
});
|
||||
|
||||
it('rgba(255,255,255,0)', function() {
|
||||
var c = new Color('rgba(255,255,255,0)');
|
||||
it('rgba(255,255,255,0)', () => {
|
||||
const c = new Color('rgba(255,255,255,0)');
|
||||
assertColor(c, 255, 255, 255, 0);
|
||||
assert.equal(c.isTransparent(), true);
|
||||
});
|
||||
|
@ -1,24 +1,15 @@
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
var html2canvas = require('../../');
|
||||
const assert = require('assert');
|
||||
const html2canvas = require('../../');
|
||||
|
||||
describe('Package', function() {
|
||||
it('should have html2canvas defined', function() {
|
||||
describe('Package', () => {
|
||||
it('should have html2canvas defined', () => {
|
||||
assert.equal(typeof html2canvas, 'function');
|
||||
});
|
||||
});
|
||||
|
||||
describe.only('requirejs', function() {
|
||||
var requirejs = require('requirejs');
|
||||
|
||||
requirejs.config({
|
||||
baseUrl: path.resolve(__dirname, '../../dist')
|
||||
});
|
||||
|
||||
it('should have html2canvas defined', function(done) {
|
||||
requirejs(['html2canvas'], function(h2c) {
|
||||
assert.equal(typeof h2c, 'function');
|
||||
it('should have html2canvas defined', done => {
|
||||
html2canvas('').catch((err) => {
|
||||
assert.equal(err, 'Provided element is not within a Document');
|
||||
done();
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user