PHP Classes

File: toastui/test/filter.spec.js

Recommend this page to a friend!
  Classes of Mark de Leon  >  PHP Document Scanner using SANE or eSCL AirPrint  >  toastui/test/filter.spec.js  >  Download  
File: toastui/test/filter.spec.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Document Scanner using SANE or eSCL AirPrint
Web interface to scan printed documents
Author: By
Last change:
Date: 1 year ago
Size: 1,545 bytes
 

Contents

Class file image Download
/**
 * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>
 * @fileoverview Test cases of "src/js/component/filter.js"
 */
import $ from 'jquery';
import ImageEditor from '../src/js/imageEditor';

describe('Filter', () => {
    let imageEditor;
    const imageURL = 'base/test/fixtures/sampleImage.jpg';

    beforeAll(done => {
        imageEditor = new ImageEditor(document.createElement('div'), {
            cssMaxWidth: 700,
            cssMaxHeight: 500
        });
        imageEditor.loadImageFromURL(imageURL, 'sampleImage').then(() => {
            done();
        });
    });

    afterAll(() => {
        imageEditor.destroy();
    });

    it('applyFilter() can add undo stack', done => {
        imageEditor.applyFilter('colorFilter').then(() => {
            expect(imageEditor.isEmptyUndoStack()).toBe(false);
            done();
        })['catch'](() => {
            fail();
            done();
        });
    });

    it('hasFilter', () => {
        expect(imageEditor.hasFilter('invert')).toBe(false);
        expect(imageEditor.hasFilter('colorFilter')).toBe(true);
    });

    it('removeFilter() can remove added filter', done => {
        imageEditor.applyFilter('colorFilter').then(() =>
            imageEditor.removeFilter('colorFilter')
        ).then(() => {
            expect(imageEditor.hasFilter('colorFilter')).toBe(false);
            expect(imageEditor.isEmptyUndoStack()).toBe(false);
            done();
        })['catch'](() => {
            fail();
            done();
        });
    });
});
For more information send a message to info at phpclasses dot org.