|
|
|
@ -55,6 +55,7 @@ describe('layui', function () {
|
|
|
|
|
|
|
|
|
|
it('router querystring', function () {
|
|
|
|
|
expect(layui.router('#/a=1/b=2/c=')).to.deep.equal($.extend({}, defaultData, {
|
|
|
|
|
href: 'a=1/b=2/c=',
|
|
|
|
|
search: {
|
|
|
|
|
a: '1',
|
|
|
|
|
b: '2',
|
|
|
|
@ -75,7 +76,8 @@ describe('layui', function () {
|
|
|
|
|
it('router hash', function () {
|
|
|
|
|
expect(layui.router('#/name#layui')).to.deep.equal($.extend({}, defaultData, {
|
|
|
|
|
hash: '#layui',
|
|
|
|
|
path: ['name']
|
|
|
|
|
path: ['name'],
|
|
|
|
|
href: 'name#layui'
|
|
|
|
|
}));
|
|
|
|
|
expect(layui.router('#/name#layui').hash).to.equal('#layui');
|
|
|
|
|
expect(layui.router('#/name#layui=1').hash).to.equal('#layui=1');
|
|
|
|
@ -90,7 +92,8 @@ describe('layui', function () {
|
|
|
|
|
search: {
|
|
|
|
|
c: '2'
|
|
|
|
|
},
|
|
|
|
|
hash: '#hash'
|
|
|
|
|
hash: '#hash',
|
|
|
|
|
href: 'a/b/c=2#hash'
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -266,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) {
|
|
|
|
@ -276,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();
|
|
|
|
|
});
|
|
|
|
@ -307,7 +308,7 @@ describe('layui', function () {
|
|
|
|
|
layui.event('test-trigger', 'click(*)', true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('trigger multiple', function () {
|
|
|
|
|
it.skip('trigger multiple', function () {
|
|
|
|
|
var index = 0;
|
|
|
|
|
var id = 'test-trigger-multiple';
|
|
|
|
|
layui.onevent(id, 'nav', function () {
|
|
|
|
|