Skip to content

Commit

Permalink
chore: adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayden Naydenov committed Nov 29, 2023
1 parent 717c5db commit 6a60141
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions packages/main/src/MultiComboBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ class MultiComboBox extends UI5Element {
this.value = this.valueBeforeAutoComplete;
}

if (!this.allowCustomValues || (!this._open && this.allowCustomValues)) {
if (!this.allowCustomValues || (!this.open && this.allowCustomValues)) {
this.value = this._lastValue;
}
}
Expand Down Expand Up @@ -1493,13 +1493,13 @@ class MultiComboBox extends UI5Element {
}

storeResponsivePopoverWidth() {
if (this._open && !this._listWidth) {
if (this.open && !this._listWidth) {
this._listWidth = this.list!.offsetWidth;
}
}

toggle(isToggled: boolean) {
if (isToggled && !this._open) {
if (isToggled && !this.open) {
this.openPopover();
} else {
this.closePopover();
Expand Down Expand Up @@ -1598,7 +1598,7 @@ class MultiComboBox extends UI5Element {
inputFocusOut(e: FocusEvent) {
if (!this.shadowRoot!.contains(e.relatedTarget as Node) && !this._deleting) {
this.focused = false;
this._tokenizer.expanded = this._open;
this._tokenizer.expanded = this.open;
// remove the value if user focus out the input and focus is not going in the popover
if (!isPhone() && !this.allowCustomValues && (this.staticAreaItem !== e.relatedTarget)) {
this.value = "";
Expand Down Expand Up @@ -1765,7 +1765,7 @@ class MultiComboBox extends UI5Element {
}

const isCurrentlyExpanded = this._tokenizer?.expanded;
const shouldBeExpanded = this.focused || this._open || isCurrentlyExpanded;
const shouldBeExpanded = this.focused || this.open || isCurrentlyExpanded;

return shouldBeExpanded;
}
Expand Down
22 changes: 11 additions & 11 deletions packages/main/test/specs/MultiComboBox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ describe("MultiComboBox general interaction", () => {

await resetBtn.click();
await icon.click();
assert.ok(await mcb.getProperty("_open"), "MultiComboBox should be opened");
assert.ok(await mcb.getProperty("open"), "MultiComboBox should be opened");
assert.strictEqual(await eventInput.getValue(), "openChange", "openChange should be called");
assert.strictEqual(await callCountInput.getValue(), "1", "Event should be called once");

await icon.click();
assert.notOk(await mcb.getProperty("_open"), "MultiComboBox should be closed");
assert.notOk(await mcb.getProperty("open"), "MultiComboBox should be closed");

assert.strictEqual(await eventInput.getValue(), "openChange", "openChange should be called");
assert.strictEqual(await callCountInput.getValue(), "2", "Event should be called once");
Expand Down Expand Up @@ -275,7 +275,7 @@ describe("MultiComboBox general interaction", () => {
await mcb.scrollIntoView();
await nMoreText.click();

await browser.waitUntil(async () => mcb.getProperty("_open"), {
await browser.waitUntil(async () => mcb.getProperty("open"), {
timeout: 500,
timeoutMsg: "Popover is open"
});
Expand All @@ -288,14 +288,14 @@ describe("MultiComboBox general interaction", () => {

await icon.click();

await browser.waitUntil(async () => !(await mcb.getProperty("_open")), {
await browser.waitUntil(async () => !(await mcb.getProperty("open")), {
timeout: 500,
timeoutMsg: "Popover should be closed"
});

await icon.click();

await browser.waitUntil(async () => await mcb.getProperty("_open"), {
await browser.waitUntil(async () => await mcb.getProperty("open"), {
timeout: 500,
timeoutMsg: "Popover should be open"
});
Expand Down Expand Up @@ -993,20 +993,20 @@ describe("MultiComboBox general interaction", () => {
await mcb.keys("F4");
await mcb.keys("Tab");

assert.equal(await mcb.getProperty("_open"), false, "The previous control is closed");
assert.equal(await mcb.getProperty("open"), false, "The previous control is closed");
assert.equal(await mcb2.getProperty("focused"), true, "The next control is focused");

await mcb2.keys("F4");
await mcb2.keys(["Shift", "Tab"]);

assert.equal(await mcb2.getProperty("_open"), false, "The next control is closed");
assert.equal(await mcb2.getProperty("open"), false, "The next control is closed");
assert.equal(await mcb.getProperty("focused"), true, "The previous control is focused");

await mcb.keys(["a", "b", "c"]);
await mcb.keys("F4");
await mcb.keys("Tab");

assert.equal(await mcb.getProperty("_open"), false, "The previous control is closed");
assert.equal(await mcb.getProperty("open"), false, "The previous control is closed");
assert.equal(await mcb.getProperty("value"), "abc", "The previous control value is set");
assert.equal(await mcb2.getProperty("focused"), true, "The next control is focused");
});
Expand All @@ -1023,23 +1023,23 @@ describe("MultiComboBox general interaction", () => {
await mcb.keys("ArrowDown");
await mcb.keys("Tab");

assert.equal(await mcb.getProperty("_open"), false, "The previous control is closed after TAB on value state header");
assert.equal(await mcb.getProperty("open"), false, "The previous control is closed after TAB on value state header");
assert.equal(await mcb2.getProperty("focused"), true, "The next control is focused after TAB on value state header");

await mcb2.keys("F4");
await mcb2.keys("ArrowDown");
await mcb2.keys("ArrowDown");
await mcb2.keys(["Shift", "Tab"]);

assert.equal(await mcb2.getProperty("_open"), false, "The next control is closed after TAB on suggestion item");
assert.equal(await mcb2.getProperty("open"), false, "The next control is closed after TAB on suggestion item");
assert.equal(await mcb.getProperty("focused"), true, "The previous control is focused after TAB on suggestion item");

await mcb.keys("F4");
await mcb.keys("ArrowDown");
await mcb.keys("ArrowDown");
await mcb.keys("Tab");

assert.equal(await mcb.getProperty("_open"), false, "The previous control is closed after TAB on suggestion item");
assert.equal(await mcb.getProperty("open"), false, "The previous control is closed after TAB on suggestion item");
assert.equal(await mcb2.getProperty("focused"), true, "The next control is focused after TAB on suggestion item");
});

Expand Down

0 comments on commit 6a60141

Please sign in to comment.