p!ranha?
Server IP : 103.169.32.36  /  Your IP : 216.73.217.13
Web Server : Apache
System : Linux web.dpmptsp 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/dpmptsp/public_html/newsigniter/assets/back/vendors/summernote_v/test/base/core/

Upload File :
Curr3nt_D!r [ Writeable ] D0cum3nt_r0Ot [ Writeable ]

 
Command :
Current File : /home/dpmptsp/public_html/newsigniter/assets/back/vendors/summernote_v/test/base/core/func.spec.js
/**
 * func.spec.js
 * (c) 2013~ Alan Hong
 * summernote may be freely distributed under the MIT license./
 */
import chai from 'chai';
import func from '../../../src/js/base/core/func';

var expect = chai.expect;

describe('base:core.func', () => {
  describe('eq', () => {
    it('should return true if two values are same', () => {
      expect(func.eq(1)(1)).to.be.ok;
    });
  });

  describe('eq2', () => {
    it('should return true if two values are same', () => {
      expect(func.eq2(1, 1)).to.be.ok;
    });

    it('should return false if two values are not same', () => {
      expect(func.eq2(1, '1')).to.be.not.ok;
    });
  });

  describe('peq2', () => {
    it('should return true when two properties are same', () => {
      expect(func.peq2('prop')({ prop: 'hello' }, { prop: 'hello' })).to.be.ok;
    });

    it('should return false when two properties are not same', () => {
      expect(func.peq2('prop')({ prop: 'hello' }, { prop: 'world' })).to.be.not.ok;
    });
  });

  describe('ok', () => {
    it('should return true', () => {
      expect(func.ok()).to.be.ok;
    });
  });

  describe('fail', () => {
    it('should return false', () => {
      expect(func.fail()).to.be.not.ok;
    });
  });

  describe('not', () => {
    it('should return opposite function', () => {
      expect(func.not(func.ok)()).to.be.not.ok;
      expect(func.not(func.fail)()).to.be.ok;
    });
  });

  describe('and', () => {
    it('should return composite function', () => {
      expect(func.and(func.ok, func.ok)()).to.be.ok;
      expect(func.and(func.fail, func.ok)()).to.be.not.ok;
      expect(func.and(func.fail, func.fail)()).to.be.not.ok;
    });
  });

  describe('invoke', () => {
    it('should return function which invoke the method', () => {
      expect(func.invoke(func, 'ok')()).to.be.ok;
      expect(func.invoke(func, 'fail')()).to.be.not.ok;
    });
  });

  describe('uniqueId', () => {
    it('should return uniqueId with the prefix as a parameter', () => {
      func.resetUniqueId();
      expect(func.uniqueId('note-')).to.be.equal('note-1');
      expect(func.uniqueId('note-')).to.be.equal('note-2');
      expect(func.uniqueId('note-')).to.be.equal('note-3');
    });
  });

  describe('invertObject', () => {
    it('should return inverted object between keys and values', () => {
      expect(func.invertObject({ keyA: 'valueA', keyB: 'valueB' }))
        .to.deep.equal({ valueA: 'keyA', valueB: 'keyB' });
    });
  });

  describe('namespaceToCamel', () => {
    it('should return camelcase text', () => {
      expect(func.namespaceToCamel('upload.image')).to.be.equal('UploadImage');
    });

    it('should return prefixed camelcase text', () => {
      expect(func.namespaceToCamel('upload.image', 'summernote')).to.be.equal('summernoteUploadImage');
    });
  });

  describe('debounce', () => {
    it('shouldnt execute immediately', () => {
      var hasHappened = false;
      var fn = func.debounce(() => {
        hasHappened = true;
      }, 100);

      expect(hasHappened).to.be.false;
      fn();
      expect(hasHappened).to.be.false;
    });

    it('should execute after delay', (done) => {
      var hasHappened = false;
      var fn = func.debounce(() => {
        hasHappened = true;
      }, 100);

      fn();

      setTimeout(() => {
        expect(hasHappened).to.be.true;
        done();
      }, 101);
    });

    it('should only happen once', (done) => {
      var count = 0;
      var fn = func.debounce(() => {
        count += 1;
      }, 100);

      fn();
      fn();
      fn();

      setTimeout(() => {
        expect(count).to.be.equal(1);
        done();
      }, 101);
    });
  });

  describe('isValidUrl', () => {
    it('should return true with valid URLs', () => {
      expect(func.isValidUrl('https://www.summernote.org')).to.be.ok;
      expect(func.isValidUrl('http://summernote.org')).to.be.ok;
      expect(func.isValidUrl('summernote.org')).to.be.ok;
    });

    it('should return false with invalid URLs', () => {
      expect(func.isValidUrl('summernote')).to.be.not.ok;
    });
  });
});
N4m3
5!z3
L45t M0d!f!3d
0wn3r / Gr0up
P3Rm!55!0n5
0pt!0n5
..
--
January 03 2025 03:29:16
0 / 0
0755
dom.spec.js
12.332 KB
December 31 2020 02:24:50
0 / 0
0644
func.spec.js
3.999 KB
December 31 2020 02:24:50
0 / 0
0644
key.spec.js
0.637 KB
December 31 2020 02:24:50
0 / 0
0644
lists.spec.js
3.196 KB
December 31 2020 02:24:50
0 / 0
0644
range.spec.js
17.112 KB
December 31 2020 02:24:50
0 / 0
0644