Skip to content

Commit ad757f4

Browse files
committed
merge changes from PR #29 for acc-react and acc-puppeteer
2 parents 4876ed0 + 100ed6c commit ad757f4

File tree

9 files changed

+65
-40
lines changed

9 files changed

+65
-40
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#AccTestTypesComponent{
2+
margin-right: 35px;
3+
}
4+
5+
#AccTestTypesLabel {
6+
display: block;
7+
margin-bottom: 6px;
8+
}
9+
10+
.AccTestTypesInput{
11+
margin-top: 4px;
12+
min-height: 35px;
13+
}

src/components/AccTestComponent/AccTestTypes/AccTestTypes.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import React from 'react';
2+
import styles from './AccTestTypes.module.scss';
23

34
const AccTestTypes = ({ dispatch, action, currTypes }) => {
45
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
56
dispatch(action(e.target.value));
67
};
78

89
return (
9-
<div id='sampleAccTest'>
10-
<label for='accTestTypes'>Choose Type of Accessibility Test: </label>
11-
<select value={currTypes} id='accTestTypes' onChange={handleChange}>
10+
<div id={styles.AccTestTypesComponent}>
11+
<label id={styles.AccTestTypesLabel} for='accTestTypes'>
12+
Choose Type of Accessibility Test
13+
</label>
14+
<select value={currTypes} id='accTestTypes' className={styles.AccTestTypesInput} onChange={handleChange}>
1215
<option value='html'>HTML</option>
1316
<option value='react'>React</option>
1417
<option value='puppeteer'>Puppeteer</option>

src/components/AccTestComponent/PuppeteerUrl/PuppeteerUrl.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import React from 'react';
2+
// import styles used in AccTestTypes for input labels et al.
3+
import styles from '../AccTestTypes/AccTestTypes.module.scss';
24

35
const AccTestTypes = ({ dispatch, action }) => {
46
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
57
dispatch(action(e.target.value));
68
};
79

810
return (
9-
<div>
10-
<label>URL to be Tested:</label>
11-
<input onChange = { handleChange }>
11+
<div id={styles.AccTestTypesComponent}>
12+
<label id={styles.AccTestTypesLabel}>URL to be Tested:</label>
13+
<input onChange = { handleChange } placeholder='https://sample.io'>
1214
</input>
1315
</div>
1416
);

src/components/Modals/modalHooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function useGenerateScript(test, testType = null, puppeteerUrl = 'sample.
5757
return (
5858
`cd ${projectFilePath}
5959
npm i -D axe-core puppeteer
60-
node <YOUR_TEST_FILE_NAME.JS> ${puppeteerUrl}
60+
node <YOUR_DIR_PATH/TEST_FILE.JS> ${puppeteerUrl}
6161
`
6262
);
6363

src/components/SearchInput/SearchInput.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ul.react-test-options li.option-active {
4848
}
4949

5050
.flex-item {
51-
width: 50%;
51+
width: 200px;
5252
margin-right: 7%;
5353
input {
5454
margin-top: 6px;

src/components/TestCase/AccTestCase.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,29 @@ const AccTestCase = () => {
5959
</div>
6060

6161
<section id={styles.testCaseHeader}>
62-
<AccTestTypes
63-
dispatch={dispatchToAccTestCase}
64-
action={updateTestType}
65-
currType={testType}
66-
/>
62+
<div id={styles.accTestDiv}>
63+
<AccTestTypes
64+
dispatch={dispatchToAccTestCase}
65+
action={updateTestType}
66+
currType={testType}
67+
/>
6768

68-
{testType === 'puppeteer' ? (
69-
<PuppeteerUrl dispatch={dispatchToAccTestCase} action={createPuppeteerUrl} />
70-
) : (
71-
<div>
72-
<label htmlFor="fileImport">Import File From</label>
73-
<div id={styles.labelInput} style={{ width: '80%' }}>
74-
<SearchInput
75-
options={Object.keys(filePathMap)}
76-
dispatch={dispatchToAccTestCase}
77-
action={updateFilePath}
78-
filePathMap={filePathMap}
79-
/>
69+
{testType === 'puppeteer' ? (
70+
<PuppeteerUrl dispatch={dispatchToAccTestCase} action={createPuppeteerUrl} />
71+
) : (
72+
<div>
73+
<label htmlFor="fileImport">Import File From</label>
74+
<div id={styles.labelInput} style={{ width: '80%' }}>
75+
<SearchInput
76+
options={Object.keys(filePathMap)}
77+
dispatch={dispatchToAccTestCase}
78+
action={updateFilePath}
79+
filePathMap={filePathMap}
80+
/>
81+
</div>
8082
</div>
81-
</div>
82-
)}
83+
)}
84+
</div>
8385

8486
<DragDropContext onDragEnd={onDragEnd}>
8587
<Droppable

src/components/TestCase/TestCase.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,8 @@ div {
149149
align-items: center;
150150
margin-top: 6px;
151151
}
152+
153+
#accTestDiv {
154+
display: flex;
155+
justify-content: flex-start;
156+
}

src/context/useGenerateTest.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ function useGenerateTest(test, projectFilePath) {
836836
} else {
837837
violations.forEach(axeViolation => {
838838
const whereItFailed = axeViolation.nodes.map(node => node.html);
839+
// uncomment the line(s) below to see suggestions on how to fix accessibility issues
839840
// const failureSummary = axeViolation.nodes.map(node => node.failureSummary);
840841
841842
const { description, help, helpUrl } = axeViolation;
@@ -845,7 +846,7 @@ function useGenerateTest(test, projectFilePath) {
845846
'\\nISSUE: ', help,
846847
'\\nMORE INFO: ', helpUrl,
847848
'\\nWHERE IT FAILED: ', whereItFailed,
848-
// '\\nhow to fix: ', failureSummary
849+
// '\\nHOW TO FIX: ', failureSummary
849850
);
850851
});
851852
}
@@ -1023,6 +1024,7 @@ function useGenerateTest(test, projectFilePath) {
10231024
const violations = results;
10241025
violations.forEach(axeViolation => {
10251026
const whereItFailed = axeViolation.nodes.map(node => node.html);
1027+
// uncomment the line(s) below to see suggestions on how to fix accessibility issues
10261028
// const failureSummary = axeViolation.nodes.map(node => node.failureSummary);
10271029
10281030
const { description, help, helpUrl } = axeViolation;
@@ -1037,7 +1039,7 @@ function useGenerateTest(test, projectFilePath) {
10371039
helpUrl,
10381040
'\\nWHERE IT FAILED: ',
10391041
whereItFailed
1040-
// '\\nhow to fix: ', failureSummary
1042+
// '\\nHOW TO FIX: ', failureSummary
10411043
);
10421044
});
10431045
})
@@ -1048,8 +1050,6 @@ function useGenerateTest(test, projectFilePath) {
10481050
`
10491051
};
10501052

1051-
//const generatePuppeteerScriptTag = () => {`"node <replaceWithJavascriptTestFileName.js> ${url}"`}
1052-
10531053
switch (test) {
10541054
case 'acc':
10551055
var accTestCase = testState;

src/pages/TestFile/TestFile.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,23 @@ const TestFile = () => {
110110
<div id={styles.body}>
111111
<p id={styles.text}>What would you like to test?</p>
112112
<span id={styles.newTestButtons}>
113-
<button id={styles.save} autoFocus onClick={() => handleToggle('react')}>
114-
React
113+
<button id={styles.save} autoFocus onClick={() => handleToggle('acc')}>
114+
Accessibility
115115
</button>
116-
<button id={styles.save} onClick={() => handleToggle('redux')}>
117-
Redux
116+
<button id={styles.save} onClick={() => handleToggle('endpoint')}>
117+
Endpoint
118118
</button>
119119
<button id={styles.save} onClick={() => handleToggle('hooks')}>
120120
Hooks
121121
</button>
122-
<button id={styles.save} onClick={() => handleToggle('endpoint')}>
123-
Endpoint
124-
</button>
125122
<button id={styles.save} onClick={() => handleToggle('puppeteer')}>
126123
Puppeteer
127124
</button>
128-
<button id={styles.save} onClick={() => handleToggle('acc')}>
129-
Accessibility
125+
<button id={styles.save} onClick={() => handleToggle('react')}>
126+
React
127+
</button>
128+
<button id={styles.save} onClick={() => handleToggle('redux')}>
129+
Redux
130130
</button>
131131
</span>
132132
</div>

0 commit comments

Comments
 (0)