From 529c544687ba3b7d5ac1f435f66a4c697479802d Mon Sep 17 00:00:00 2001 From: xuexb Date: Tue, 28 Nov 2017 10:44:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20`layui.sort`=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E5=80=BC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/layui.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/layui.js b/test/layui.js index 9b69142f..d0b0214b 100644 --- a/test/layui.js +++ b/test/layui.js @@ -346,17 +346,14 @@ describe('layui', function () { ]; it('check params and return value', function () { - // 由于没有值参数, 导致 JSON.parse 失败 - expect(function () { - layui.sort(); - }).to.throw(); + expect(layui.sort()).to.deep.equal([], '空参数时默认为空数组'); - expect(layui.sort({})).to.deep.equal({}); + expect(layui.sort({})).to.deep.equal({}, '只传空对象默认返回'); expect(layui.sort({ name: 'layui' })).to.deep.equal({ name: 'layui' - }); + }, '只传一个对象参数时返回'); expect(layui.sort([{ name: 'layui'