utils.test.js 1004 字节
Newer Older
J
JiM-W 已提交
1 2 3 4 5 6 7 8 9
const utils = require('../utils.js');
const {expect} = require('chai');

describe('utils.js', function() {
  it('test getStyleKeyValue', function() {
    let source = `background-url:(http:www.didi.chameleon.png)`
    let result = utils.getStyleKeyValue(source);
    expect(result).to.include.keys('key');
    expect(result).to.include.keys('value');
Y
yylgit 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22
  });
  it('test handleEventType', function() {
    expect(utils.handleEventType('touchStart')).to.equal('touchstart')
    expect(utils.handleEventType('touchMove')).to.equal('touchmove')
    expect(utils.handleEventType('touchEnd')).to.equal('touchend')
    expect(utils.handleEventType('tap')).to.equal('tap')
  });
  it('test handleCompEventType', function() {
    expect(utils.handleCompEventType('touchstart')).to.equal('touchStart')
    expect(utils.handleCompEventType('touchmove')).to.equal('touchMove')
    expect(utils.handleCompEventType('touchend')).to.equal('touchEnd')
    expect(utils.handleCompEventType('tap')).to.equal('tap')
  });
J
JiM-W 已提交
23
})