(core) Change datepicker in DateEditor to use moment format, show AltText in DateEditor

Summary:
- Rather than translate from moment format to that of bootstrap-datepicker, use
  the customization methods to format datepicker dates using moment directly.
- Fix issue with parseDate() when format includes tokens like Mo or Do
- Fix issue in parseDateTime() that could produce an off-by-one error in date
  depending on local timezone.
- When opening DateEditor, show AltText value if present.

- Add crossorigin=anonymous to scripts that were missing it (including
  bootstrap-datepicker), to ensure that errors from them are reported properly
  rather than as 'Script error.'

Test Plan:
Added test cases to parseDate() test for low-level fixes; added a
browser test for the fixed DateEditor behavior.

Reviewers: alexmojaki

Reviewed By: alexmojaki

Differential Revision: https://phab.getgrist.com/D3169
This commit is contained in:
Dmitry S
2021-12-07 01:19:27 -05:00
parent faec8177ab
commit 7a6d726daa
5 changed files with 42 additions and 55 deletions

View File

@@ -1012,7 +1012,7 @@ export async function setType(type: RegExp, options: {skipWait?: boolean} = {})
await toggleSidePanel('right', 'open');
await driver.find('.test-right-tab-field').click();
await driver.find('.test-fbuilder-type-select').click();
await driver.findContent('.test-select-menu .test-select-row', type).click();
await driver.findContentWait('.test-select-menu .test-select-row', type, 200).click();
if (!options.skipWait) { await waitForServer(); }
}
@@ -1710,7 +1710,7 @@ export async function getDateFormat(): Promise<string> {
*/
export async function setDateFormat(format: string) {
await driver.find('[data-test-id=Widget_dateFormat]').click();
await driver.findContent('.test-select-menu .test-select-row', format).click();
await driver.findContentWait('.test-select-menu .test-select-row', format, 200).click();
await waitForServer();
}