Skip to content

Commit

Permalink
Merge pull request #9 from SeanMcP/v1.1
Browse files Browse the repository at this point in the history
V1.1
  • Loading branch information
SeanMcP authored Sep 5, 2019
2 parents 8e336bb + a5cdafc commit bef75c9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 44 deletions.
75 changes: 38 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
{
"name": "a11y-react-emoji",
"version": "1.0.2",
"description": "An accessible Emoji component for React applications",
"main": "lib/index.js",
"repository": "https://github.com/seanmcp/a11y-react-emoji",
"homepage": "https://github.com/seanmcp/a11y-react-emoji#readme",
"bugs": "https://github.com/seanmcp/a11y-react-emoji/issues",
"author": "Sean McPherson <[email protected]> (https://github.com/seanmcp)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.11",
"@types/react": "^16.7.18",
"@types/react-dom": "^16.0.11",
"jest": "^23.6.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"ts-jest": "^23.10.5",
"typescript": "^3.2.2"
},
"peerDependencies": {
"react": "^16.7.0",
"react-dom": "^16.7.0"
},
"scripts": {
"build": "rm -rf \"./lib\" && mkdir \"./lib\" && tsc",
"test": "jest"
},
"files": [
"lib"
],
"keywords": [
"react",
"emoji",
"a11y",
"accessibility",
"accessible"
]
"name": "a11y-react-emoji",
"version": "1.1.1",
"description": "An accessible Emoji component for React applications",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": "https://github.com/seanmcp/a11y-react-emoji",
"homepage": "https://github.com/seanmcp/a11y-react-emoji#readme",
"bugs": "https://github.com/seanmcp/a11y-react-emoji/issues",
"author": "Sean McPherson <[email protected]> (https://github.com/seanmcp)",
"license": "MIT",
"devDependencies": {
"@types/jest": "^23.3.11",
"@types/react": "^16.7.18",
"@types/react-dom": "^16.0.11",
"jest": "^23.6.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"ts-jest": "^23.10.5",
"typescript": "^3.2.2"
},
"peerDependencies": {
"react": "^16.7.0",
"react-dom": "^16.7.0"
},
"scripts": {
"build": "rm -rf \"./lib\" && mkdir \"./lib\" && tsc",
"test": "jest"
},
"files": [
"lib"
],
"keywords": [
"react",
"emoji",
"a11y",
"accessibility",
"accessible"
]
}
6 changes: 3 additions & 3 deletions src/Emoji.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ test('Is a defined function', () => {

test('Sets aria-hidden, -label when label prop is NOT passed', () => {
const output = Emoji({ symbol: props.symbol });
expect(output.props['aria-hidden']).toMatch('true');
expect(output.props['aria-label']).toBe(null);
expect(output.props['aria-hidden']).toBe(true);
expect(output.props['aria-label']).toBe(undefined);
});

test('Sets aria-hidden, -label when label prop IS passed', () => {
const output = Emoji(props);
expect(output.props['aria-hidden']).toBe(null);
expect(output.props['aria-hidden']).toBe(undefined);
expect(output.props['aria-label']).toMatch(props.label);
});
8 changes: 4 additions & 4 deletions src/Emoji.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as React from 'react';

interface EmojiProps {
interface Props extends React.HTMLAttributes<HTMLSpanElement> {
label?: string;
symbol: string;
}

function Emoji(props: EmojiProps) {
function Emoji(props: Props) {
const { label, symbol, ...rest } = props;
return (
<span
aria-hidden={label ? null : 'true'}
aria-label={label ? label : null}
aria-hidden={label ? undefined : true}
aria-label={label ? label : undefined}
role="img"
{...rest}
>
Expand Down

0 comments on commit bef75c9

Please sign in to comment.