Skip to content

Commit

Permalink
[Leipzig][Desktop] Fix empty fields profile data in Settings.
Browse files Browse the repository at this point in the history
This CL fixes a bug introduced in https://crrev.com/c/4218499.
The format of data for empty fields was changed, but
the backend part does not expect it, which leads to
inability to remove a single element array field.

Bug: 1408423
Change-Id: I2394e94b29d245a39739326e530ab829fe090d6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4264097
Reviewed-by: Viktor Semeniuk <vsemeniuk@google.com>
Commit-Queue: Dmitry Vykochko <vykochko@google.com>
Cr-Commit-Position: refs/heads/main@{#1107247}
  • Loading branch information
DVykochko authored and Chromium LUCI CQ committed Feb 19, 2023
1 parent bcf786b commit 520426d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class ArrayStringComponentUi extends
}

protected setValue(value: string|undefined, address: AddressEntry): void {
address[this.property] = isValueNonEmpty(value) ? [value!] : undefined;
address[this.property] = isValueNonEmpty(value) ? [value!] : [];
}
}

Expand Down
6 changes: 3 additions & 3 deletions chrome/test/data/webui/settings/autofill_section_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'chrome://settings/settings.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {AutofillManagerImpl, CountryDetailManagerImpl, CrInputElement, CrTextareaElement} from 'chrome://settings/lazy_load.js';
import {assertEquals, assertFalse, assertGT, assertTrue} from 'chrome://webui-test/chai_assert.js';
import {assertArrayEquals, assertEquals, assertFalse, assertGT, assertTrue} from 'chrome://webui-test/chai_assert.js';
import {eventToPromise, whenAttributeIs, isVisible} from 'chrome://webui-test/test_util.js';
import {flushTasks} from 'chrome://webui-test/polymer_test_util.js';

Expand Down Expand Up @@ -440,8 +440,8 @@ suite('AutofillSectionAddressTests', function() {
return expectEvent(dialog, 'save-address', function() {
dialog.$.saveButton.click();
}).then(function() {
assertEquals(undefined, address.phoneNumbers);
assertEquals(undefined, address.emailAddresses);
assertArrayEquals([], address.phoneNumbers!);
assertArrayEquals([], address.emailAddresses!);
});
});
});
Expand Down

0 comments on commit 520426d

Please sign in to comment.