-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ui-text-input): migrate old TextInput tests
Closes: INSTUI-4156
- Loading branch information
Showing
7 changed files
with
507 additions
and
334 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React from 'react' | ||
import { TextInput } from '../../packages/ui' | ||
|
||
import '../support/component' | ||
import 'cypress-real-events' | ||
|
||
describe('<TextInput/>', () => { | ||
const contentBeforeSVG = ( | ||
<svg height="24" width="24"> | ||
<title>Content before</title> | ||
<circle cx="50" cy="50" r="40" /> | ||
</svg> | ||
) | ||
|
||
const contentAfterSVG = ( | ||
<svg height="24" width="24"> | ||
<title>Content after</title> | ||
<circle cx="50" cy="50" r="40" /> | ||
</svg> | ||
) | ||
it('should prepend and append content', async () => { | ||
cy.mount( | ||
<TextInput | ||
renderLabel="Name" | ||
renderBeforeInput={() => contentBeforeSVG} | ||
/> | ||
) | ||
|
||
cy.get('span[class$="__beforeElement"]') | ||
.should('exist') | ||
.and('have.text', 'Content before') | ||
|
||
cy.get('[data-cy-root]').then(() => { | ||
cy.mount( | ||
<TextInput | ||
renderLabel="Name" | ||
renderBeforeInput={() => contentBeforeSVG} | ||
renderAfterInput={() => contentAfterSVG} | ||
/> | ||
) | ||
}) | ||
|
||
cy.get('svg title').eq(0).should('have.text', 'Content before') | ||
cy.get('svg title').eq(1).should('have.text', 'Content after') | ||
|
||
cy.get('svg').should('have.length', 2) | ||
}) | ||
|
||
it('should have no padding on empty before/after content', async () => { | ||
cy.mount( | ||
<TextInput | ||
renderLabel="Name" | ||
renderBeforeInput={<span id="before"></span>} | ||
renderAfterInput={<span id="after"></span>} | ||
/> | ||
) | ||
|
||
cy.get('[class*="__beforeElement"]').should( | ||
'have.css', | ||
'padding-inline-start', | ||
'0px' | ||
) | ||
cy.get('[class*="__afterElement"]').should( | ||
'have.css', | ||
'padding-inline-end', | ||
'0px' | ||
) | ||
|
||
cy.get('[data-cy-root]').then(() => { | ||
cy.mount( | ||
<TextInput | ||
renderLabel="Name" | ||
renderBeforeInput={() => contentBeforeSVG} | ||
renderAfterInput={() => contentAfterSVG} | ||
/> | ||
) | ||
}) | ||
|
||
cy.get('[class*="__beforeElement"]').should( | ||
'have.css', | ||
'padding-inline-start', | ||
'12px' | ||
) | ||
cy.get('[class*="__afterElement"]').should( | ||
'have.css', | ||
'padding-inline-end', | ||
'12px' | ||
) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
packages/instui-config/package-lists/v11/package-list.json
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,107 @@ | ||
[ | ||
"@instructure/babel-plugin-transform-imports", | ||
"@instructure/browserslist-config-instui", | ||
"@instructure/canvas-high-contrast-theme", | ||
"@instructure/canvas-theme", | ||
"@instructure/command-utils", | ||
"@instructure/console", | ||
"@instructure/cz-lerna-changelog", | ||
"@instructure/debounce", | ||
"@instructure/emotion", | ||
"@instructure/instui-config", | ||
"@instructure/shared-types", | ||
"@instructure/template-app", | ||
"@instructure/template-component", | ||
"@instructure/template-package", | ||
"@instructure/theme-registry", | ||
"@instructure/ui", | ||
"@instructure/ui-a11y-content", | ||
"@instructure/ui-a11y-utils", | ||
"@instructure/ui-alerts", | ||
"@instructure/ui-avatar", | ||
"@instructure/ui-axe-check", | ||
"@instructure/ui-badge", | ||
"@instructure/ui-billboard", | ||
"@instructure/ui-breadcrumb", | ||
"@instructure/ui-buttons", | ||
"@instructure/ui-byline", | ||
"@instructure/ui-calendar", | ||
"@instructure/ui-checkbox", | ||
"@instructure/ui-code-editor", | ||
"@instructure/ui-codemods", | ||
"@instructure/ui-color-picker", | ||
"@instructure/ui-color-utils", | ||
"@instructure/ui-date-input", | ||
"@instructure/ui-date-time-input", | ||
"@instructure/ui-decorator", | ||
"@instructure/ui-dialog", | ||
"@instructure/ui-dom-utils", | ||
"@instructure/ui-drawer-layout", | ||
"@instructure/ui-drilldown", | ||
"@instructure/ui-editable", | ||
"@instructure/ui-expandable", | ||
"@instructure/ui-file-drop", | ||
"@instructure/ui-flex", | ||
"@instructure/ui-focusable", | ||
"@instructure/ui-form-field", | ||
"@instructure/ui-grid", | ||
"@instructure/ui-heading", | ||
"@instructure/ui-i18n", | ||
"@instructure/ui-icons", | ||
"@instructure/ui-icons-build", | ||
"@instructure/ui-img", | ||
"@instructure/ui-link", | ||
"@instructure/ui-list", | ||
"@instructure/ui-menu", | ||
"@instructure/ui-metric", | ||
"@instructure/ui-modal", | ||
"@instructure/ui-motion", | ||
"@instructure/ui-navigation", | ||
"@instructure/ui-number-input", | ||
"@instructure/ui-options", | ||
"@instructure/ui-overlays", | ||
"@instructure/ui-pages", | ||
"@instructure/ui-pagination", | ||
"@instructure/ui-pill", | ||
"@instructure/ui-popover", | ||
"@instructure/ui-portal", | ||
"@instructure/ui-position", | ||
"@instructure/ui-progress", | ||
"@instructure/ui-prop-types", | ||
"@instructure/ui-radio-input", | ||
"@instructure/ui-range-input", | ||
"@instructure/ui-rating", | ||
"@instructure/ui-react-utils", | ||
"@instructure/ui-responsive", | ||
"@instructure/ui-select", | ||
"@instructure/ui-selectable", | ||
"@instructure/ui-side-nav-bar", | ||
"@instructure/ui-simple-select", | ||
"@instructure/ui-source-code-editor", | ||
"@instructure/ui-spinner", | ||
"@instructure/ui-svg-images", | ||
"@instructure/ui-table", | ||
"@instructure/ui-tabs", | ||
"@instructure/ui-tag", | ||
"@instructure/ui-test-locator", | ||
"@instructure/ui-test-queries", | ||
"@instructure/ui-test-sandbox", | ||
"@instructure/ui-test-utils", | ||
"@instructure/ui-testable", | ||
"@instructure/ui-text", | ||
"@instructure/ui-text-area", | ||
"@instructure/ui-text-input", | ||
"@instructure/ui-theme-tokens", | ||
"@instructure/ui-themes", | ||
"@instructure/ui-time-select", | ||
"@instructure/ui-toggle-details", | ||
"@instructure/ui-tooltip", | ||
"@instructure/ui-top-nav-bar", | ||
"@instructure/ui-tray", | ||
"@instructure/ui-tree-browser", | ||
"@instructure/ui-truncate-list", | ||
"@instructure/ui-truncate-text", | ||
"@instructure/ui-utils", | ||
"@instructure/ui-view", | ||
"@instructure/uid" | ||
] |
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
Oops, something went wrong.