提交 27fea3f8 编写于 作者: W wang-xupeng2

update search/marquee/textArea

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 d7ae7fb8
...@@ -134,18 +134,20 @@ export default function SearchJsunit() { ...@@ -134,18 +134,20 @@ export default function SearchJsunit() {
let textComponent1 = await driver.findComponent(BY.key('search')); let textComponent1 = await driver.findComponent(BY.key('search'));
await textComponent1.inputText("hello") await textComponent1.inputText("hello")
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let change = await driver.findComponent(BY.key('change')); let strJson1 = getInspectorByKey('change');
let text1 = await change.getText(); let obj1 = JSON.parse(strJson1);
expect(text1).assertEqual('onChange:hello'); console.info("[SearchJsunit_0300] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onChange:hello');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// Verify the onSubmit function of the Search component // Verify the onSubmit function of the Search component
let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH')); let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH'));
await textComponent2.click() await textComponent2.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let submit = await driver.findComponent(BY.key('submit')); let strJson2 = getInspectorByKey('submit');
let text2 = await submit.getText(); let obj2 = JSON.parse(strJson2);
expect(text2).assertEqual('onSubmit:hello'); console.info("[SearchJsunit_0300] obj2: " + JSON.stringify(obj2));
expect(obj2.$attrs.content).assertEqual('onSubmit:hello');
// Verify the onCopy function of the Search component // Verify the onCopy function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
...@@ -154,9 +156,11 @@ export default function SearchJsunit() { ...@@ -154,9 +156,11 @@ export default function SearchJsunit() {
await textComponent3.click() await textComponent3.click()
let textComponent4 = await driver.findComponent(BY.text('复制')); let textComponent4 = await driver.findComponent(BY.text('复制'));
await textComponent4.click() await textComponent4.click()
let copy = await driver.findComponent(BY.key('copy')); await CommonFunc.sleep(1000);
let text3 = await copy.getText(); let strJson3 = getInspectorByKey('copy');
expect(text3).assertEqual('onCopy:hello'); let obj3 = JSON.parse(strJson3);
console.info("[SearchJsunit_0300] obj3: " + JSON.stringify(obj3));
expect(obj3.$attrs.content).assertEqual('onCopy:hello');
// Verify the onCut function of the Search component // Verify the onCut function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
...@@ -165,25 +169,29 @@ export default function SearchJsunit() { ...@@ -165,25 +169,29 @@ export default function SearchJsunit() {
await textComponent5.click() await textComponent5.click()
let textComponent6 = await driver.findComponent(BY.text('剪切')); let textComponent6 = await driver.findComponent(BY.text('剪切'));
await textComponent6.click() await textComponent6.click()
let cut = await driver.findComponent(BY.key('cut')); await CommonFunc.sleep(1000);
let text4 = await cut.getText(); let strJson4 = getInspectorByKey('cut');
expect(text4).assertEqual('onCut:hello'); let obj4 = JSON.parse(strJson4);
console.info("[SearchJsunit_0300] obj4: " + JSON.stringify(obj4));
expect(obj4.$attrs.content).assertEqual('onCut:hello');
// Verify the onPaste function of the Search component // Verify the onPaste function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent8 = await driver.findComponent(BY.text('粘贴')); let textComponent8 = await driver.findComponent(BY.text('粘贴'));
await textComponent8.click() await textComponent8.click()
let paste = await driver.findComponent(BY.key('paste')); await CommonFunc.sleep(1000);
let text5 = await paste.getText(); let strJson5 = getInspectorByKey('paste');
expect(text5).assertEqual('onPaste:hello'); let obj5 = JSON.parse(strJson5);
console.info("[SearchJsunit_0300] obj5: " + JSON.stringify(obj5));
expect(obj5.$attrs.content).assertEqual('onPaste:hello');
// Verify the caretPosition function of the Search component // Verify the caretPosition function of the Search component
let textComponent7 = await driver.findComponent(BY.key('button')); let textComponent7 = await driver.findComponent(BY.key('button'));
await textComponent7.click(); await textComponent7.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let text6 = await textComponent7.getText(); let text = await textComponent7.getText();
expect(text6).assertEqual('Set caretPosition 2'); expect(text).assertEqual('Set caretPosition 2');
console.info('[SearchJsunit_0300] END'); console.info('[SearchJsunit_0300] END');
done(); done();
}); });
...@@ -227,7 +235,7 @@ export default function SearchJsunit() { ...@@ -227,7 +235,7 @@ export default function SearchJsunit() {
expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg'); expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH'); expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A'); expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A');
expect(obj.$attrs.value).assertEqual('hello'); expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
......
...@@ -131,7 +131,7 @@ export default function marqueeJsunit() { ...@@ -131,7 +131,7 @@ export default function marqueeJsunit() {
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
// to confirm // to confirm
expect(obj.$attrs.step).assertEqual('1.000000'); expect(parseInt(obj.$attrs.step)).assertEqual(vp2px(6));
done(); done();
}); });
......
...@@ -158,13 +158,9 @@ export default function textAreaJsunit() { ...@@ -158,13 +158,9 @@ export default function textAreaJsunit() {
it('textAreaJsunit_0800', 0, async function (done) { it('textAreaJsunit_0800', 0, async function (done) {
console.info('textAreaJsunit_0800 START'); console.info('textAreaJsunit_0800 START');
// globalThis.value.message.notify({name:'placeholder',value:''}) globalThis.value.message.notify({name:'text',value:''})
let driver = UiDriver.create();
let allSelect = await driver.findComponent(BY.text('全选'));
await allSelect.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let cutComponent = await driver.findComponent(BY.text('剪切')); let driver = UiDriver.create();
await cutComponent.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the change event // test the change event
let text = await driver.findComponent(BY.key('textArea')); let text = await driver.findComponent(BY.key('textArea'));
...@@ -210,7 +206,7 @@ export default function textAreaJsunit() { ...@@ -210,7 +206,7 @@ export default function textAreaJsunit() {
}); });
it('textAreaJsunit_1000', 0, async function (done) { it('textAreaJsunit_1000', 0, async function (done) {
console.info('marqueeJsunit_0900 START'); console.info('textAreaJsunit_1000 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the cut event // test the cut event
let driver = UiDriver.create(); let driver = UiDriver.create();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册