Skip to content

Commit 352fb20

Browse files
committed
test: add file input attr test
1 parent 1627c71 commit 352fb20

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

dev/schema.js

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ module.exports = {
227227
required: true,
228228
browse: true,
229229
hideInput: false,
230+
inputName: "photo",
230231
validator: validators.required
231232
},
232233
{

test/unit/specs/fields/fieldImage.spec.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("fieldImage.vue", function() {
2626
readonly: false
2727
};
2828
let model = { avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg" };
29-
let input;
29+
let input, fileInput;
3030

3131
before( () => {
3232
createField(this, schema, model, false);
@@ -46,7 +46,7 @@ describe("fieldImage.vue", function() {
4646
});
4747

4848
it("should contain a file input element", () => {
49-
let fileInput = el.querySelector("input[type=file]");
49+
fileInput = el.querySelector("input[type=file]");
5050
expect(fileInput).to.be.defined;
5151
expect(fileInput.classList.contains("form-control")).to.be.true;
5252
expect(fileInput.classList.contains("file")).to.be.true;
@@ -67,7 +67,7 @@ describe("fieldImage.vue", function() {
6767
});
6868
});
6969

70-
describe("check optional attribute", () => {
70+
describe("check optional attribute on text input", () => {
7171
let attributes = ["autocomplete", "disabled", "placeholder", "readonly"];
7272

7373
attributes.forEach(function(name) {
@@ -77,6 +77,17 @@ describe("fieldImage.vue", function() {
7777
});
7878
});
7979

80+
// TODO: not working inputName test.
81+
describe.skip("check optional attribute on file input", () => {
82+
let attributes = ["disabled", "inputName"];
83+
84+
attributes.forEach(function(name) {
85+
it("should set " + name, function(done) {
86+
checkAttribute(name, vm, fileInput, field, schema, done);
87+
});
88+
});
89+
});
90+
8091
it("input value should be the model value after changed", (done) => {
8192
model.avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/felipebsb/128.jpg";
8293
vm.$nextTick( () => {

0 commit comments

Comments
 (0)