forked from fanruan/fineui
Browse Source
* commit '70911f87af7f7c16b28361aadafd3044a61ea4d1': BI-47579 refactor: 取首字母拼音可选是否需要拼接多音字 BI-48238 && BI-48234 button事件测试补充与位置移动es6
guy
6 years ago
11 changed files with 294 additions and 69 deletions
@ -0,0 +1,139 @@
|
||||
/** |
||||
* Created by windy on 2018/01/23. |
||||
*/ |
||||
describe("ButtonTest", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("Click点击触发事件", function (done) { |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
handler: function () { |
||||
this.setText("click"); |
||||
} |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.click(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("MouseDown触发事件", function (done) { |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
trigger: "mousedown", |
||||
handler: function () { |
||||
this.setText("click"); |
||||
} |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.mousedown(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("MouseUp触发事件", function (done) { |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
trigger: "mouseup", |
||||
handler: function () { |
||||
this.setText("click"); |
||||
} |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.mousedown(); |
||||
button.element.mouseup(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("doubleClick触发事件", function (done) { |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
trigger: "dblclick", |
||||
handler: function () { |
||||
this.setText("click"); |
||||
} |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.dblclick(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("LongClick触发事件", function (done) { |
||||
var clickNum = 0; |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
trigger: "lclick", |
||||
listeners: [{ |
||||
eventName: BI.Button.EVENT_CHANGE, |
||||
action: function () { |
||||
clickNum++; |
||||
} |
||||
}] |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.mousedown(); |
||||
BI.delay(function () { |
||||
expect(clickNum).to.equal(2); |
||||
button.destroy(); |
||||
done(); |
||||
}, 360); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
it("LongClick触发事件", function (done) { |
||||
var clickNum = 0; |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
trigger: "lclick", |
||||
listeners: [{ |
||||
eventName: BI.Button.EVENT_CHANGE, |
||||
action: function () { |
||||
clickNum++; |
||||
} |
||||
}] |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.dblclick(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
}); |
@ -0,0 +1,84 @@
|
||||
/** |
||||
* Created by windy on 2018/01/23. |
||||
*/ |
||||
describe("TextTest", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setText", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text" |
||||
}); |
||||
text.setText("AAA"); |
||||
expect(text.element.text()).to.equal("AAA"); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setStyle", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text" |
||||
}); |
||||
text.setStyle({"color": "red"}); |
||||
expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)"); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("高亮doHighlight", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text", |
||||
text: "AAA", |
||||
highLight: true |
||||
}); |
||||
expect(text.element.getStyle("color")).to.equal("rgb(54, 133, 242)"); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("标红doRedMark", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text", |
||||
text: "我是要标红的A", |
||||
keyword: "A" |
||||
}); |
||||
expect(text.element.children(".bi-keyword-red-mark").length).to.not.equal(0); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("取消高亮undoHighlight", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text", |
||||
text: "AAA", |
||||
highLight: true |
||||
}); |
||||
text.unHighLight(); |
||||
expect(text.element.getStyle("color")).to.not.equal("rgb(54, 133, 242)"); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("取消标红undoRedMark", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text", |
||||
text: "我是要标红的A", |
||||
keyword: "A" |
||||
}); |
||||
text.unRedMark(); |
||||
expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); |
||||
text.destroy(); |
||||
}); |
||||
}); |
@ -1,25 +0,0 @@
|
||||
/** |
||||
* Created by windy on 2018/01/23. |
||||
*/ |
||||
describe("ButtonTest", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("EventClickTest", function (done) { |
||||
var button = BI.Test.createWidget({ |
||||
type: "bi.button", |
||||
text: "CCC", |
||||
handler: function () { |
||||
this.setText("click"); |
||||
} |
||||
}); |
||||
BI.nextTick(function () { |
||||
button.element.click(); |
||||
expect(button.element.children(".bi-text").text()).to.equal("click"); |
||||
button.destroy(); |
||||
done(); |
||||
}); |
||||
|
||||
}); |
||||
}); |
@ -1,29 +0,0 @@
|
||||
/** |
||||
* Created by windy on 2018/01/23. |
||||
*/ |
||||
describe("TextTest", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setText", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text" |
||||
}); |
||||
text.setText("AAA"); |
||||
expect(text.element.text()).to.equal("AAA"); |
||||
text.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setStyle", function () { |
||||
var text = BI.Test.createWidget({ |
||||
type: "bi.text" |
||||
}); |
||||
text.setStyle({"color": "red"}); |
||||
expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)"); |
||||
text.destroy(); |
||||
}); |
||||
}); |
Loading…
Reference in new issue