Skip to content

Commit

Permalink
Merge branch 'main' into 9072-formgroup-legend-id
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jul 8, 2021
2 parents 67f3fc0 + 81e9cc6 commit 09fe996
Show file tree
Hide file tree
Showing 73 changed files with 2,128 additions and 572 deletions.
2 changes: 1 addition & 1 deletion config/eslint-config-carbon/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-config-carbon",
"description": "ESLint configuration for Carbon",
"version": "2.6.0",
"version": "2.7.0-rc.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": {
Expand Down
94 changes: 94 additions & 0 deletions config/eslint-config-carbon/plugins/testing-library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = {
plugins: ['testing-library'],
overrides: [
{
// extends: ['plugin:testing-library/react'],
files: ['**/components/**/Link-test.js'],
rules: {
// Enforce promises from async queries to be handled
'testing-library/await-async-query': 'error',

// Enforce async utils to be awaited properly
'testing-library/await-async-utils': 'error',

// Enforce promises from fire event methods to be handled
'testing-library/await-fire-event': 'error',

// Ensure `data-testid` values match a provided regex.
'testing-library/consistent-data-testid': 'off',

// Disallow unnecessary `await` for sync events
'testing-library/no-await-sync-events': 'error',

// Disallow unnecessary `await` for sync queries
'testing-library/no-await-sync-query': 'error',

// Disallow the use of `container` methods
'testing-library/no-container': 'error',

// Disallow the use of debugging utilities like `debug`
'testing-library/no-debug': 'error',

// Disallow importing from DOM Testing Library
'testing-library/no-dom-import': 'error',

// Disallow the use of `cleanup`
'testing-library/no-manual-cleanup': 'error',

// Disallow direct Node access
'testing-library/no-node-access': 'error',

// Disallow the use of promises passed to a `fireEvent` method
'testing-library/no-promise-in-fire-event': 'error',

// Disallow the use of `render` in setup functions
'testing-library/no-render-in-setup': 'error',

// Disallow wrapping Testing Library utils or empty callbacks in `act`
'testing-library/no-unnecessary-act': 'error',

// Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved`
'testing-library/no-wait-for-empty-callback': 'error',

// Disallow the use of multiple expect inside `waitFor`
'testing-library/no-wait-for-multiple-assertions': 'error',

// Disallow the use of side effects inside `waitFor`
'testing-library/no-wait-for-side-effects': 'error',

// Ensures no snapshot is generated inside of a `waitFor` call
'testing-library/no-wait-for-snapshot': 'error',

// Suggest using explicit assertions rather than just `getBy*` queries
'testing-library/prefer-explicit-assert': 'error',

// Suggest using `findBy*` methods instead of the `waitFor` + `getBy` queries
'testing-library/prefer-find-by': 'error',

// Enforce specific queries when checking element is present or not
'testing-library/prefer-presence-queries': 'error',

// Suggest using screen while using queries
'testing-library/prefer-screen-queries': 'error',

// Suggest using `userEvent` library instead of `fireEvent` for simulating user interaction
'testing-library/prefer-user-event': 'error',

// Use `waitFor` instead of deprecated wait methods
'testing-library/prefer-wait-for': 'error',

// Enforce a valid naming for return value from `render`
'testing-library/render-result-naming-convention': 'off',
},
},
],
};
6 changes: 5 additions & 1 deletion config/jest-config-carbon/matchers/toHaveNoACViolations.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use strict';

const aChecker = require('accessibility-checker');
let aChecker = null;

async function toHaveNoACViolations(node, label) {
if (aChecker === null) {
aChecker = require('accessibility-checker');
}

let results = await aChecker.getCompliance(node, label);
if (aChecker.assertCompliance(results.report) === 0) {
return {
Expand Down
2 changes: 1 addition & 1 deletion config/jest-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jest-config-carbon",
"private": true,
"description": "Jest configuration and preset for Carbon",
"version": "0.5.0",
"version": "0.6.0-rc.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions config/jest-config-carbon/setup/setupAfterEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const util = require('util');
const toHaveNoAxeViolations = require('../matchers/toHaveNoAxeViolations');
const toHaveNoACViolations = require('../matchers/toHaveNoACViolations');

require('@testing-library/jest-dom');

// We can extend `expect` using custom matchers as defined by:
// https://jest-bot.github.io/jest/docs/expect.html#expectextendmatchers
//
Expand Down
32 changes: 0 additions & 32 deletions e2e/icons-react/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2402,45 +2402,13 @@ Array [
"Globe20",
"Globe24",
"Globe32",
"GlyphCaution16",
"GlyphCaution20",
"GlyphCaution24",
"GlyphCaution32",
"GlyphCautionGlyph",
"GlyphCautionInverted16",
"GlyphCautionInverted20",
"GlyphCautionInverted24",
"GlyphCautionInverted32",
"GlyphCautionInvertedGlyph",
"GlyphCircleFill16",
"GlyphCircleFill20",
"GlyphCircleFill24",
"GlyphCircleFill32",
"GlyphCircleFillGlyph",
"GlyphCircleStroke16",
"GlyphCircleStroke20",
"GlyphCircleStroke24",
"GlyphCircleStroke32",
"GlyphCircleStrokeGlyph",
"GlyphCritical16",
"GlyphCritical20",
"GlyphCritical24",
"GlyphCritical32",
"GlyphCriticalGlyph",
"GlyphIncomplete16",
"GlyphIncomplete20",
"GlyphIncomplete24",
"GlyphIncomplete32",
"GlyphIncompleteGlyph",
"GlyphSquareFill16",
"GlyphSquareFill20",
"GlyphSquareFill24",
"GlyphSquareFill32",
"GlyphSquareFillGlyph",
"GlyphUndefined16",
"GlyphUndefined20",
"GlyphUndefined24",
"GlyphUndefined32",
"GlyphUndefinedGlyph",
"Gradient16",
"Gradient20",
Expand Down
32 changes: 0 additions & 32 deletions e2e/icons-vue/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2403,45 +2403,13 @@ Array [
"Globe20",
"Globe24",
"Globe32",
"GlyphCaution16",
"GlyphCaution20",
"GlyphCaution24",
"GlyphCaution32",
"GlyphCautionGlyph",
"GlyphCautionInverted16",
"GlyphCautionInverted20",
"GlyphCautionInverted24",
"GlyphCautionInverted32",
"GlyphCautionInvertedGlyph",
"GlyphCircleFill16",
"GlyphCircleFill20",
"GlyphCircleFill24",
"GlyphCircleFill32",
"GlyphCircleFillGlyph",
"GlyphCircleStroke16",
"GlyphCircleStroke20",
"GlyphCircleStroke24",
"GlyphCircleStroke32",
"GlyphCircleStrokeGlyph",
"GlyphCritical16",
"GlyphCritical20",
"GlyphCritical24",
"GlyphCritical32",
"GlyphCriticalGlyph",
"GlyphIncomplete16",
"GlyphIncomplete20",
"GlyphIncomplete24",
"GlyphIncomplete32",
"GlyphIncompleteGlyph",
"GlyphSquareFill16",
"GlyphSquareFill20",
"GlyphSquareFill24",
"GlyphSquareFill32",
"GlyphSquareFillGlyph",
"GlyphUndefined16",
"GlyphUndefined20",
"GlyphUndefined24",
"GlyphUndefined32",
"GlyphUndefinedGlyph",
"Gradient16",
"Gradient20",
Expand Down
32 changes: 0 additions & 32 deletions e2e/icons/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2402,45 +2402,13 @@ Array [
"Globe20",
"Globe24",
"Globe32",
"GlyphCaution16",
"GlyphCaution20",
"GlyphCaution24",
"GlyphCaution32",
"GlyphCautionGlyph",
"GlyphCautionInverted16",
"GlyphCautionInverted20",
"GlyphCautionInverted24",
"GlyphCautionInverted32",
"GlyphCautionInvertedGlyph",
"GlyphCircleFill16",
"GlyphCircleFill20",
"GlyphCircleFill24",
"GlyphCircleFill32",
"GlyphCircleFillGlyph",
"GlyphCircleStroke16",
"GlyphCircleStroke20",
"GlyphCircleStroke24",
"GlyphCircleStroke32",
"GlyphCircleStrokeGlyph",
"GlyphCritical16",
"GlyphCritical20",
"GlyphCritical24",
"GlyphCritical32",
"GlyphCriticalGlyph",
"GlyphIncomplete16",
"GlyphIncomplete20",
"GlyphIncomplete24",
"GlyphIncomplete32",
"GlyphIncompleteGlyph",
"GlyphSquareFill16",
"GlyphSquareFill20",
"GlyphSquareFill24",
"GlyphSquareFill32",
"GlyphSquareFillGlyph",
"GlyphUndefined16",
"GlyphUndefined20",
"GlyphUndefined24",
"GlyphUndefined32",
"GlyphUndefinedGlyph",
"Gradient16",
"Gradient20",
Expand Down
12 changes: 6 additions & 6 deletions packages/carbon-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@carbon/react",
"private": true,
"description": "React components for the Carbon Design System",
"version": "0.6.0",
"version": "0.7.0-rc.0",
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -41,11 +41,11 @@
},
"dependencies": {
"@carbon/feature-flags": "^0.5.0",
"@carbon/icons-react": "^10.34.0",
"@carbon/styles": "^0.9.0",
"@carbon/icons-react": "^10.35.0-rc.0",
"@carbon/styles": "^0.10.0-rc.0",
"@carbon/telemetry": "0.0.0-alpha.6",
"@ibm/plex": "6.0.0-next.6",
"carbon-components-react": "^7.38.0"
"carbon-components-react": "^7.39.0-rc.0"
},
"devDependencies": {
"@babel/core": "^7.14.2",
Expand All @@ -55,8 +55,8 @@
"@babel/plugin-transform-react-constant-elements": "^7.13.13",
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
"@carbon/styles": "^0.9.0-rc.0",
"@carbon/themes": "^10.37.0",
"@carbon/styles": "^0.10.0-rc.0",
"@carbon/themes": "^10.38.0-rc.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
Expand Down
44 changes: 44 additions & 0 deletions packages/carbon-react/src/components/Tabs/Tabs.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { Button, Tab, Tabs, TabsSkeleton } from '../Tabs';

export default {
title: 'Components/Tabs',
parameters: {
component: Tabs,
subcomponents: {
Tab,
TabsSkeleton,
},
},
};

export const Default = () => (
<Tabs>
<Tab id="tab-1" label="Tab label 1">
<p>Content for first tab goes here.</p>
</Tab>
<Tab id="tab-2" label="Tab label 2">
<p>Content for second tab goes here.</p>
<Button>With a button</Button>
</Tab>
<Tab id="tab-3" label="Tab label 3" disabled>
<p>Content for third tab goes here.</p>
</Tab>
<Tab
id="tab-4"
label="Tab label 4 shows truncation"
title="Tab label 4 shows truncation">
<p>Content for fourth tab goes here.</p>
</Tab>
<Tab label={<div>Custom Label</div>}>
<p>Content for fifth tab goes here.</p>
</Tab>
</Tabs>
);
8 changes: 8 additions & 0 deletions packages/carbon-react/src/components/Tabs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

export { Tab, Tabs, TabsSkeleton, Button } from 'carbon-components-react';
Loading

0 comments on commit 09fe996

Please sign in to comment.