(core) Add overflowTooltip() tool, and use for long tables in widget picker, and long page names.

Summary:
Usage is simply to call `overflowTooltip()` with no arguments, as an argument
to an element whose text may overflow. On 'mouseenter', it'll check for
overflow and show the element's .textContent in a tooltip.

- Added for long table names in the widget picker (Add Page, Add Widget to Page).
- Added for long page names in the left-panel list of pages.

Test Plan: Added test cases for the new overflow tooltips

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3814
This commit is contained in:
Dmitry S
2023-03-13 03:03:59 -04:00
parent b312b3b08b
commit 86681de595
4 changed files with 58 additions and 4 deletions

View File

@@ -259,6 +259,26 @@ describe('Pages', function() {
assert.include(await gu.getPageNames(), 'People');
});
it('should show tooltip for long page names on hover', async () => {
await gu.openPageMenu('People');
await driver.find('.test-docpage-rename').doClick();
await driver.find('.test-docpage-editor')
.sendKeys('People, Persons, Humans, Ladies & Gentlemen', Key.ENTER);
await gu.waitForServer();
await driver.findContent('.test-treeview-label', /People, Persons, Humans, Ladies & Gentlemen/).mouseMove();
await driver.wait(() => driver.findWait('.test-tooltip', 1000).isDisplayed(), 3000);
assert.equal(await driver.find('.test-tooltip').getText(),
'People, Persons, Humans, Ladies & Gentlemen');
await gu.undo();
assert.deepEqual(await gu.getPageNames(), ['Interactions', 'Documents', 'People', 'User & Leads', 'Overview']);
await driver.findContent('.test-treeview-label', /People/).mouseMove();
await driver.sleep(500);
assert.equal(await driver.find('.test-tooltip').isPresent(), false);
});
it('should not change page when clicking the input while renaming page', async () => {
// check that initially People is selected
assert.match(await driver.find('.test-treeview-itemHeader.selected').getText(), /People/);