fix canvas-rce <Select> bugs
Closes: CORE-1606 CORE-1607 This commit goes back to using a <Select> w/ native <option>s. The new <Select> in ui-forms still has a bunch of edge-cases it needs to work out. Test plan: * run through the test plan on the 2 linked jira tickets and make sure They work * also run through the test plan from g/155334 and make sure those all still work. Change-Id: I292e1d1f7ea5f177eb02526f286b90f8233487f1 Reviewed-on: https://gerrit.instructure.com/156474 Reviewed-by: Clay Diffrient <cdiffrient@instructure.com> Tested-by: Jenkins QA-Review: Jeremy Putnam <jeremyp@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
6b58f9233d
commit
e2ea2e93e3
|
@ -22,7 +22,7 @@ import React, { Component } from "react";
|
|||
import ReactCSSTransitionGroup from "react-transition-group/CSSTransitionGroup";
|
||||
import formatMessage from "../../format-message";
|
||||
import ScreenReaderContent from "@instructure/ui-a11y/lib/components/ScreenReaderContent";
|
||||
import Select from "@instructure/ui-forms/lib/components/Select";
|
||||
import Select from "@instructure/ui-core/lib/components/Select";
|
||||
import Button from "@instructure/ui-buttons/lib/components/Button";
|
||||
import Alert from "@instructure/ui-alerts/lib/components/Alert";
|
||||
import IconAddSolid from "@instructure/ui-icons/lib/Solid/IconAdd";
|
||||
|
@ -91,11 +91,11 @@ class UploadForm extends Component {
|
|||
this.props.startUpload(fileMetaProps);
|
||||
}
|
||||
|
||||
handleFolderChange(e, selected) {
|
||||
handleFolderChange(e) {
|
||||
e.preventDefault();
|
||||
this.setState({
|
||||
file: {
|
||||
parentFolderId: selected.value,
|
||||
parentFolderId: e.target.value,
|
||||
name: this.state.file.name,
|
||||
size: this.state.file.size,
|
||||
contentType: this.state.file.contentType,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import React, { Component } from "react";
|
||||
import formatMessage from "../../format-message";
|
||||
import Select from "@instructure/ui-forms/lib/components/Select";
|
||||
import Select from "@instructure/ui-core/lib/components/Select";
|
||||
import TextInput from "@instructure/ui-forms/lib/components/TextInput";
|
||||
import Alert from '@instructure/ui-alerts/lib/components/Alert';
|
||||
|
||||
|
@ -64,12 +64,12 @@ export default class UsageRightsForm extends Component {
|
|||
return this.state.usageRight === Object.keys(usageRightsValues)[0];
|
||||
}
|
||||
|
||||
handleUsageRight = (ev, selected) => {
|
||||
this.setState({ usageRight: selected.value });
|
||||
handleUsageRight = ev => {
|
||||
this.setState({ usageRight: ev.target.value });
|
||||
};
|
||||
|
||||
handleCCLicense = (ev, selected) => {
|
||||
this.setState({ ccLicense: selected.value });
|
||||
handleCCLicense = ev => {
|
||||
this.setState({ ccLicense: ev.target.value });
|
||||
};
|
||||
|
||||
handleCopyrightHolder = ev => {
|
||||
|
|
|
@ -401,15 +401,17 @@ describe("UploadForm", () => {
|
|||
});
|
||||
|
||||
describe("handleFolderChange", () => {
|
||||
let ev, form, selected, value;
|
||||
let ev, form, value;
|
||||
|
||||
beforeEach(() => {
|
||||
value = 123;
|
||||
ev = { preventDefault: sinon.spy() };
|
||||
selected = { value };
|
||||
ev = {
|
||||
preventDefault: sinon.spy(),
|
||||
target: { value }
|
||||
};
|
||||
form = new UploadForm({});
|
||||
sinon.stub(form, "setState");
|
||||
form.handleFolderChange(ev, selected);
|
||||
form.handleFolderChange(ev);
|
||||
});
|
||||
|
||||
it("prevents default on event", () => {
|
||||
|
|
|
@ -58,24 +58,23 @@ describe("UsageRightsForm", () => {
|
|||
});
|
||||
|
||||
describe("events handlers", () => {
|
||||
let event, selected;
|
||||
let event;
|
||||
|
||||
beforeEach(() => {
|
||||
event = {
|
||||
preventDefault() {},
|
||||
target: { value: "foo" }
|
||||
};
|
||||
selected= { value: "bar" };
|
||||
});
|
||||
|
||||
it("handleUsageRight", () => {
|
||||
instance.handleUsageRight(event, selected);
|
||||
equal(instance.state.usageRight, selected.value);
|
||||
instance.handleUsageRight(event);
|
||||
equal(instance.state.usageRight, event.target.value);
|
||||
});
|
||||
|
||||
it("handleCCLicense", () => {
|
||||
instance.handleCCLicense(event, selected);
|
||||
equal(instance.state.ccLicense, selected.value);
|
||||
instance.handleCCLicense(event);
|
||||
equal(instance.state.ccLicense, event.target.value);
|
||||
});
|
||||
|
||||
it("handleCopyrightHolder", () => {
|
||||
|
|
Loading…
Reference in New Issue