Skip to content

Commit

Permalink
Merge pull request #26841 from code-dot-org/ha/scholarship
Browse files Browse the repository at this point in the history
Application dashboard: Scholarship Teacher? field fix
  • Loading branch information
islemaster committed Feb 1, 2019
2 parents 1d51f45 + 6426749 commit 08f43cf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,24 +491,16 @@ export class DetailViewContents extends React.Component {
};

renderScholarshipStatusAnswer = () => {
if (this.state.editing && this.props.isWorkshopAdmin) {
return (
<FormGroup>
<Select
value={this.state.scholarship_status}
onChange={this.handleScholarshipStatusChange}
options={ScholarshipDropdownOptions}
/>
</FormGroup>
);
}

const option = ScholarshipDropdownOptions.find((option) => {
return option.value === this.state.scholarship_status;
});
if (option) {
return option.label;
}
return (
<FormGroup>
<Select
value={this.state.scholarship_status}
onChange={this.handleScholarshipStatusChange}
options={ScholarshipDropdownOptions}
disabled={!this.state.editing}
/>
</FormGroup>
);
};

renderEditButtons = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,28 @@ describe("DetailViewContents", () => {
expect(detailView.find('#notes_2').prop('disabled')).to.be.true;
});
});

describe('Scholarship Teacher? row', () => {
it('on teacher applications', () => {
const detailView = mountDetailView('Teacher');
const lastRow = detailView.find('tr').filterWhere(row => row.text().includes('Scholarship Teacher?'));
const dropdown = lastRow.find('Select');

// Dropdown is disabled
expect(dropdown).to.have.prop('disabled', true);

// Click "Edit"
detailView.find('#DetailViewHeader Button').last().simulate('click');

// Dropdown is enabled
expect(dropdown).to.have.prop('disabled', false);

// Click "Save"
detailView.find('#DetailViewHeader Button').last().simulate('click');

// Dropdown is disabled
expect(dropdown).to.have.prop('disabled', true);
});
});
}
});

0 comments on commit 08f43cf

Please sign in to comment.