Browse Source

BI-61182 test: 修复改了text空格显示后的报错单测

es6
windy 5 years ago
parent
commit
5f4d4df574
  1. 2
      src/base/single/__test__/text.test.js
  2. 49
      src/case/loader/__test__/loader.lazy.test.js
  3. 3
      src/case/loader/loader.lazy.js
  4. 2
      src/core/__test__/alias.test.js
  5. 6
      src/widget/datetime/__test__/datetime.test.js
  6. 4
      src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
  7. 2
      src/widget/timeinterval/__test__/timeinterval.test.js

2
src/base/single/__test__/text.test.js

@ -117,7 +117,7 @@ describe("TextTest", function () {
type: "bi.text",
text: "我是要标红的 A",
});
expect(text.element.text()).to.equal("我是要标红的 A");
expect(text.element.text()).to.equal("我是要标红的 A");
text.destroy();
});

49
src/case/loader/__test__/loader.lazy.test.js

@ -0,0 +1,49 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/4/3
*/
describe("lazy_loader", function () {
/**
* test_author_windy
**/
it("setValue", function () {
var items = BI.map(BI.range(0, 100), function (idx, v) {
return {
type: "bi.single_select_item",
text: v,
value: v
}
});
var widget = BI.Test.createWidget({
type: "bi.lazy_loader",
el: {
layouts: [{
type: "bi.left",
hgap: 5
}]
}
});
widget.populate(items);
expect(widget.getAllButtons().length).to.equal(100);
widget.addItems([{
type: "bi.single_select_item",
text: 102,
value: 102
}, {
type: "bi.single_select_item",
text: 103,
value: 103
}]);
expect(widget.getAllLeaves().length).to.equal(102);
widget.setValue(102);
expect(widget.getValue()[0]).to.equal(102);
expect(widget.getSelectedButtons().length).to.equal(1);
widget.setNotSelectedValue(102);
expect(widget.getNotSelectedValue()[0]).to.equal(102);
expect(widget.getNotSelectedButtons().length).to.equal(1);
widget.destroy();
});
});

3
src/case/loader/loader.lazy.js

@ -8,7 +8,8 @@ BI.LazyLoader = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.LazyLoader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-lazy-loader",
el: {}
el: {},
items: []
});
},

2
src/core/__test__/alias.test.js

@ -18,7 +18,7 @@ describe("aliasFunctionTest", function () {
var targetString = "<a>1 2&</a>";
var encodeString = BI.htmlEncode(targetString);
expect(encodeString).to.equal("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(encodeString).to.equal("&lt;a&gt;1 2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).to.equal(targetString);
});

6
src/widget/datetime/__test__/datetime.test.js

@ -28,7 +28,7 @@ describe("DateTime", function () {
second: 12
}
});
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
});
@ -51,7 +51,7 @@ describe("DateTime", function () {
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12");
dateCombo.destroy();
done();
})
@ -77,7 +77,7 @@ describe("DateTime", function () {
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(取消)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
done();
})

4
src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js

@ -32,7 +32,7 @@ describe("DateTimeCombo", function () {
}
});
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
done();
})
@ -318,7 +318,7 @@ describe("DateTimeCombo", function () {
input.val("2017-1-1");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).to.equal("2017-01-01 00:00:00");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).to.equal("2017-01-01 00:00:00");
dateCombo.destroy();
done();
}, 300);

2
src/widget/timeinterval/__test__/timeinterval.test.js

@ -61,7 +61,7 @@ describe("DateInterval", function () {
}
},
});
expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00");
expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00");
dateInterval.destroy();
});

Loading…
Cancel
Save