Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file widget tests #1285

Merged
merged 13 commits into from
May 22, 2019
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ language:
- node_js
node_js:
- "6"
- "7"
- "8"
- "9"
- "10"
- "11"
- "12"
env:
- ACTION=test
- ACTION="run lint"
Expand Down
4 changes: 2 additions & 2 deletions src/components/widgets/FileWidget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from "react";
import PropTypes from "prop-types";

import { dataURItoBlob, shouldRender, setState } from "../../utils";
import { dataURItoBlob, shouldRender } from "../../utils";

function addNameToDataURL(dataURL, name) {
return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
Expand Down Expand Up @@ -79,7 +79,7 @@ class FileWidget extends Component {
values: filesInfo.map(fileInfo => fileInfo.dataURL),
filesInfo,
};
setState(this, state, () => {
this.setState(state, () => {
if (multiple) {
onChange(state.values);
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/StringField_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ describe("StringField", () => {
describe("FileWidget", () => {
const initialValue = "data:text/plain;name=file1.txt;base64,dGVzdDE=";

it("should render a color field", () => {
it("should render a file field", () => {
const { node } = createFormComponent({
schema: {
type: "string",
Expand All @@ -1581,7 +1581,7 @@ describe("StringField", () => {
const { comp } = createFormComponent({
schema: {
type: "string",
format: "color",
format: "data-url",
default: initialValue,
},
});
Expand Down