fix property errors in PlannerHeader specs

refs ADMIN-798

test plan:
- specs pass without these errors
- opportunities badge on bell button still reads screen reader label in
  Firefox with JAWS

Change-Id: I611c911b4378c157170f0a0fe1e55093b4578c8d
Reviewed-on: https://gerrit.instructure.com/156747
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
Tested-by: Jenkins
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Carl Kibler <ckibler@instructure.com>
This commit is contained in:
Jon Willesen 2018-07-10 10:55:42 -06:00 committed by Carl Kibler
parent 4b92e98854
commit f1e52ed466
3 changed files with 55 additions and 32 deletions

View File

@ -30,7 +30,7 @@ const plannerDays = [
function defaultProps (options) {
return {
courses: [{id: "1", shortName: "Course Short Name", informStudentsOfOverdueSubmissions: true}],
courses: [{id: "1", longName: "Course Long Name", shortName: "Course Short Name", informStudentsOfOverdueSubmissions: true}],
opportunities: {
items: [{id: "1", course_id: "1", due_at: "2017-03-09T20:40:35Z", html_url: "http://www.non_default_url.com", name: "learning object title"}],
nextUrl: null
@ -160,9 +160,9 @@ it('does not call getNextOpportunities when component has loaded all opportuniti
const mockDispatch = jest.fn();
const props = defaultProps();
props.courses = [
{id: "1", shortName: "Course Short Name"},
{id: "2", shortName: "Course Other Name"},
{id: "3", shortName: "Course Big Name"}
{id: "1", longName: "Course Long Name", shortName: "Course Short Name"},
{id: "2", longName: "Course Other Long Name", shortName: "Course Other Name"},
{id: "3", longName: "Course Big Long Name", shortName: "Course Big Name"}
];
props.opportunities.items = [
@ -207,9 +207,9 @@ it('does call getNextOpportunities when component has 9 opportunities', () => {
const mockDispatch = jest.fn();
const props = defaultProps();
props.courses = [
{id: "1", shortName: "Course Short Name"},
{id: "2", shortName: "Course Other Name"},
{id: "3", shortName: "Course Big Name"}
{id: "1", longName: "Course Long Name", shortName: "Course Short Name"},
{id: "2", longName: "Course Other Long Name", shortName: "Course Other Name"},
{id: "3", longName: "Course Big Long Name", shortName: "Course Big Name"}
];
props.opportunities.items = [
@ -249,9 +249,9 @@ it('opens tray if todo update item props is set', () => {
const mockDispatch = jest.fn();
const props = defaultProps();
props.courses = [
{id: "1", shortName: "Course Short Name"},
{id: "2", shortName: "Course Other Name"},
{id: "3", shortName: "Course Big Name"}
{id: "1", longName: "Course Long Name", shortName: "Course Short Name"},
{id: "2", longName: "Course Other Long Name", shortName: "Course Other Name"},
{id: "3", longName: "Course Big Long Name", shortName: "Course Big Name"}
];
props.opportunities.items = [
@ -273,13 +273,13 @@ it('opens tray if todo update item props is set', () => {
const wrapper = shallow(
<PlannerHeader {...props} />
);
props.todo = {
updateTodoItem: {
id: 10
}
};
wrapper.setProps(props);
expect(wrapper.state().trayOpen).toEqual(true);
});
@ -288,9 +288,9 @@ it('shows all opportunities on badge even when we have over 10 items', () => {
const mockDispatch = jest.fn();
const props = defaultProps();
props.courses = [
{id: "1", shortName: "Course Short Name"},
{id: "2", shortName: "Course Other Name"},
{id: "3", shortName: "Course Big Name"}
{id: "1", longName: "Course Long Name", shortName: "Course Short Name"},
{id: "2", longName: "Course Other Long Name", shortName: "Course Other Name"},
{id: "3", longName: "Course Big Long Name", shortName: "Course Big Name"}
];
props.opportunities.items = [

View File

@ -106,12 +106,16 @@ exports[`new activity button does not show when there is no new activity 1`] = `
type="count"
variant="primary"
>
<IconAlerts />
<ScreenReaderContent
as="span"
<View
display="auto"
>
1 opportunity
</ScreenReaderContent>
<IconAlerts />
<ScreenReaderContent
as="span"
>
1 opportunity
</ScreenReaderContent>
</View>
</Badge>
</Button>
</PopoverTrigger>
@ -122,6 +126,7 @@ exports[`new activity button does not show when there is no new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -186,6 +191,7 @@ exports[`new activity button does not show when there is no new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -243,6 +249,7 @@ exports[`new activity button does not show when there is no new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -380,12 +387,16 @@ exports[`new activity button shows when there is new activity 1`] = `
type="count"
variant="primary"
>
<IconAlerts />
<ScreenReaderContent
as="span"
<View
display="auto"
>
1 opportunity
</ScreenReaderContent>
<IconAlerts />
<ScreenReaderContent
as="span"
>
1 opportunity
</ScreenReaderContent>
</View>
</Badge>
</Button>
</PopoverTrigger>
@ -396,6 +407,7 @@ exports[`new activity button shows when there is new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -460,6 +472,7 @@ exports[`new activity button shows when there is new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -517,6 +530,7 @@ exports[`new activity button shows when there is new activity 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -654,12 +668,16 @@ exports[`renders the base component correctly with buttons and trays 1`] = `
type="count"
variant="primary"
>
<IconAlerts />
<ScreenReaderContent
as="span"
<View
display="auto"
>
1 opportunity
</ScreenReaderContent>
<IconAlerts />
<ScreenReaderContent
as="span"
>
1 opportunity
</ScreenReaderContent>
</View>
</Badge>
</Button>
</PopoverTrigger>
@ -670,6 +688,7 @@ exports[`renders the base component correctly with buttons and trays 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -734,6 +753,7 @@ exports[`renders the base component correctly with buttons and trays 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]
@ -791,6 +811,7 @@ exports[`renders the base component correctly with buttons and trays 1`] = `
Object {
"id": "1",
"informStudentsOfOverdueSubmissions": true,
"longName": "Course Long Name",
"shortName": "Course Short Name",
},
]

View File

@ -364,8 +364,10 @@ export class PlannerHeader extends Component {
buttonRef={(b) => { this.opportunitiesHtmlButton = b; }}
>
<Badge {...this.props.loading.allOpportunitiesLoaded && this.state.opportunities.length ? {count :this.state.opportunities.length} : {}}>
<IconAlertsLine/>
<ScreenReaderContent>{this.opportunityTitle()}</ScreenReaderContent>
<View>
<IconAlertsLine/>
<ScreenReaderContent>{this.opportunityTitle()}</ScreenReaderContent>
</View>
</Badge>
</Button>
</PopoverTrigger>