Browse Source

fix: 修复 layui.event 事件参数

pull/118/head
xuexb 7 years ago
parent
commit
59e0f9d7bd
  1. 8
      test/layui.js

8
test/layui.js vendored

@ -269,9 +269,7 @@ describe('layui', function () {
expect(layui.onevent()).to.deep.equal(layui);
expect(layui.onevent([], [], [])).to.deep.equal(layui);
expect(layui.onevent({}, {}, {})).to.deep.equal(layui);
var result = layui.onevent('test-' + Date.now(), 'click', function () {});
expect(result).to.deep.equal(layui);
expect(layui.onevent('test-' + Date.now(), 'click', function () {})).to.not.deep.equal(layui);
});
it('bind event', function (done) {
@ -279,8 +277,8 @@ describe('layui', function () {
var data = {
name: 'layui'
};
var result = layui.onevent(id, 'click', function (param) {
expect(result).to.deep.equal(this).and.equal(layui);
layui.onevent(id, 'click', function (param) {
expect(this).to.deep.equal(layui);
expect(param).to.deep.equal(data);
done();
});

Loading…
Cancel
Save