-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a11y and RTL support to AlignmentMatrixControl
Also refactors isRTL / useRTL from the rtl utils.
- Loading branch information
Showing
10 changed files
with
331 additions
and
93 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,21 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
Cell as CellView, | ||
Point, | ||
} from './styles/alignment-matrix-control-styles'; | ||
|
||
export default function Cell( { isActive = false, value, ...props } ) { | ||
return ( | ||
<CellView | ||
aria-selected={ isActive } | ||
aria-label={ value } | ||
role="option" | ||
tabIndex={ -1 } | ||
{ ...props } | ||
> | ||
<Point isActive={ isActive } role="presentation" /> | ||
</CellView> | ||
); | ||
} |
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
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
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
40 changes: 40 additions & 0 deletions
40
packages/components/src/alignment-matrix-control/test/index.js
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,40 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { render, unmountComponentAtNode } from 'react-dom'; | ||
import { act } from 'react-dom/test-utils'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import AlignmentMatrixControl from '../'; | ||
|
||
let container = null; | ||
|
||
beforeEach( () => { | ||
container = document.createElement( 'div' ); | ||
document.body.appendChild( container ); | ||
} ); | ||
|
||
afterEach( () => { | ||
unmountComponentAtNode( container ); | ||
container.remove(); | ||
container = null; | ||
} ); | ||
|
||
const getControl = () => { | ||
return container.querySelector( '.component-alignment-matrix-control' ); | ||
}; | ||
|
||
describe( 'AlignmentMatrixControl', () => { | ||
describe( 'Basic rendering', () => { | ||
it( 'should render', () => { | ||
act( () => { | ||
render( <AlignmentMatrixControl />, container ); | ||
} ); | ||
const control = getControl(); | ||
|
||
expect( control ).toBeTruthy(); | ||
} ); | ||
} ); | ||
} ); |
Oops, something went wrong.