-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
packages/nimble-components/src/tooltip/tests/tooltip-matrix.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import type { Meta, Story } from '@storybook/html'; | ||
import { withXD } from 'storybook-addon-xd-designs'; | ||
import { html, ViewTemplate } from '@microsoft/fast-element'; | ||
import { | ||
createMatrix, | ||
sharedMatrixParameters | ||
} from '../../utilities/tests/matrix'; | ||
import { | ||
createMatrixThemeStory, | ||
createStory | ||
} from '../../utilities/tests/storybook'; | ||
import { hiddenWrapper } from '../../utilities/tests/hidden'; | ||
import '../../all-components'; | ||
|
||
const metadata: Meta = { | ||
title: 'Tests/Tooltip', | ||
decorators: [withXD], | ||
parameters: { | ||
...sharedMatrixParameters(), | ||
design: { | ||
artboardUrl: | ||
'https://xd.adobe.com/view/8ce280ab-1559-4961-945c-182955c7780b-d9b1/screen/044414d7-1714-40f2-9679-2ce2c8202d1c/specs/' | ||
} | ||
} | ||
}; | ||
|
||
export default metadata; | ||
|
||
const horiontalViewportLockStates = [ | ||
['horiontalViewportLock Checked', true], | ||
['horiontalViewportLock Unchecked', false] | ||
] as const; | ||
type HoriontalViewportLockState = typeof horiontalViewportLockStates[number]; | ||
|
||
const verticalViewportLockStates = [ | ||
['verticalViewportLock Checked', true], | ||
['verticalViewportLock Unchecked', false] | ||
] as const; | ||
type VerticalViewportLockState = typeof verticalViewportLockStates[number]; | ||
|
||
// WIP need to figure out anchoring | ||
|
||
const component = ( | ||
[horiontalViewportLockName, horiontalViewportLock]: HoriontalViewportLockState, | ||
[verticalViewportLockName, verticalViewportLock]: VerticalViewportLockState, | ||
): ViewTemplate => html` | ||
<nimble-button | ||
id="anchor">${horiontalViewportLockName} ${verticalViewportLockName} | ||
</nimble-button> | ||
<nimble-tooltip | ||
anchor='anchor' | ||
?horiontalViewportLock="${() => horiontalViewportLock}" | ||
?verticalViewportLock="${() => verticalViewportLock}" | ||
> | ||
text | ||
</nimble-tooltip>`; | ||
|
||
export const tooltipThemeMatrix: Story = createMatrixThemeStory( | ||
createMatrix(component, [ | ||
horiontalViewportLockStates, | ||
verticalViewportLockStates | ||
]) | ||
); | ||
|
||
export const hiddenTooltip: Story = createStory( | ||
hiddenWrapper( | ||
html`<nimble-tooltip hidden>Hidden Tooltip</nimble-tooltip>` | ||
) | ||
); |
17 changes: 17 additions & 0 deletions
17
packages/nimble-components/src/tooltip/tests/tooltip.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { | ||
DesignSystem, | ||
Tooltip as FoundationTooltip | ||
} from '@microsoft/fast-foundation'; | ||
import { Tooltip } from '..'; | ||
|
||
describe('Tooltip', () => { | ||
it('should have its tag returned by tagFor(FoundationTooltip)', () => { | ||
expect(DesignSystem.tagFor(FoundationTooltip)).toBe('nimble-tooltip'); | ||
}); | ||
|
||
it('can construct an element instance', () => { | ||
expect(document.createElement('nimble-tooltip')).toBeInstanceOf( | ||
Tooltip | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters