Skip to content

Commit

Permalink
Fix tests and lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
msmithNI committed Aug 9, 2024
1 parent 3e0cc93 commit 6681a48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,8 @@ implements Subscriber {
newColumnIndex,
true
);
return true;
}
return true;
}

return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
/* eslint-disable no-await-in-loop */
import {
children,
customElement,
elements,
html,
observable,
ref,
when
} from '@microsoft/fast-element';
import { customElement, html, observable, when } from '@microsoft/fast-element';
import { FoundationElement } from '@microsoft/fast-foundation';
import {
keyArrowDown,
Expand Down Expand Up @@ -1443,11 +1435,14 @@ describe('Table keyboard navigation', () => {
cellView.isTabbable = false;
await waitForUpdatesAsync();

// Note: At this point, the table lost focus already, because the focused element in the cell has been removed from the DOM, and
// KeyboardNavigationManager will only set focus to new elements when the table is already focused (so we don't steal focus from
// elsewhere on the page if the table isn't being interacted with).
element.focus();
await waitForUpdatesAsync();
// Note: At this point, the focused element in the cell has been already removed from the DOM.
// KeyboardNavigationManager will only set focus to new elements when the table is already focused (so we don't
// steal focus from elsewhere on the page if the table isn't being interacted with).
// In Chrome, the table loses focus entirely, but not in Firefox/WebKit.
if (element.shadowRoot!.activeElement === null) {
element.focus(); // Refocus table if it's been lost
await waitForUpdatesAsync();
}

expect(currentFocusedElement()).toBe(
pageObject.getCell(0, 1)
Expand Down
13 changes: 2 additions & 11 deletions packages/nimble-components/src/table/tests/table.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { attr, customElement, html } from '@microsoft/fast-element';
import { html } from '@microsoft/fast-element';
import { parameterizeSpec } from '@ni/jasmine-parameterized';
import { Table, tableTag } from '..';
import { TableColumn } from '../../table-column/base';
import { TableColumnText, tableColumnTextTag } from '../../table-column/text';
import { TableColumnTextCellView } from '../../table-column/text/cell-view';
import { waitForUpdatesAsync } from '../../testing/async-helpers';
import { controlHeight } from '../../theme-provider/design-tokens';
import { waitForEvent } from '../../utilities/testing/component';
import {
type Fixture,
fixture,
uniqueElementName
} from '../../utilities/tests/fixture';
import { type Fixture, fixture } from '../../utilities/tests/fixture';
import {
TableColumnAlignment,
TableColumnSortDirection,
Expand All @@ -21,12 +15,9 @@ import {
} from '../types';
import { TablePageObject } from '../testing/table.pageobject';
import {
tableColumnEmptyGroupHeaderViewTag,
TableColumnValidationTest,
tableColumnValidationTestTag
} from '../../table-column/base/tests/table-column.fixtures';
import type { ColumnInternalsOptions } from '../../table-column/base/models/column-internals';
import { ColumnValidator } from '../../table-column/base/models/column-validator';

interface SimpleTableRecord extends TableRecord {
stringData: string;
Expand Down

0 comments on commit 6681a48

Please sign in to comment.