mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-12 11:20:02 +01:00
Added Eslint and husky (#1062)
This commit is contained in:
@@ -2,14 +2,14 @@ var test = require('tape');
|
||||
require('../../../src/ImageSequencer.js');
|
||||
|
||||
var sequencer = ImageSequencer({ ui: false });
|
||||
var red = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z";
|
||||
var red = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z';
|
||||
|
||||
test('toString() and stepToString() return the step/steps in string format', function(t) {
|
||||
sequencer.loadImages(red);
|
||||
sequencer.addSteps('channel');
|
||||
sequencer.addSteps('invert');
|
||||
t.equal(sequencer.toString(), "channel{},invert{}", "toString works");
|
||||
t.equal(sequencer.stepToString(sequencer.steps[1]), "channel{}", "stepToString works");
|
||||
t.equal(sequencer.toString(), 'channel{},invert{}', 'toString works');
|
||||
t.equal(sequencer.stepToString(sequencer.steps[1]), 'channel{}', 'stepToString works');
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ test('stringToJSON() and stringToJSONstep() return the step/steps from a string'
|
||||
{ name: 'crop', options: { x: '0', y: '0', w: '50%', h: '50%' } },
|
||||
{ name: 'blend', options: { blend: 'function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }' } }
|
||||
]);
|
||||
t.deepEqual(sequencer.stringToJSONstep("channel{channel:green}"), { name: 'channel', options: { channel: 'green' } });
|
||||
t.deepEqual(sequencer.stringToJSONstep('channel{channel:green}'), { name: 'channel', options: { channel: 'green' } });
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ test('toJSON() returns the right sequence of steps', function(t) {
|
||||
|
||||
test('importString() imports a string of steps into the sequencer', function(t) {
|
||||
sequencer.importString('brightness{brightness:50},invert');
|
||||
t.equal(sequencer.toString(), "channel{},invert{},brightness{brightness:50},invert{}");
|
||||
t.equal(sequencer.toString(), 'channel{},invert{},brightness{brightness:50},invert{}');
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ test('importJSON() imports a JSON array of steps into the sequencer', function(t
|
||||
sequencer.importJSON([
|
||||
{ name: 'blur', options: {} }
|
||||
]);
|
||||
t.equal(sequencer.toString(), "channel{},invert{},brightness{brightness:50},invert{},blur{}")
|
||||
t.equal(sequencer.toString(), 'channel{},invert{},brightness{brightness:50},invert{},blur{}');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user