Skip to content

Commit

Permalink
new: hideInput prop in fieldImage #77
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Sep 26, 2016
1 parent ebf7484 commit deb4ec5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fields/fieldImage.vue
@@ -1,6 +1,6 @@
<template lang="jade">
div.wrapper
input.form-control.link(type="text", v-model="wrappedValue", :autocomplete="schema.autocomplete", :disabled="disabled", :placeholder="schema.placeholder", :readonly="schema.readonly")
input.form-control.link(type="text", v-show="schema.hideInput !== true", v-model="wrappedValue", :autocomplete="schema.autocomplete", :disabled="disabled", :placeholder="schema.placeholder", :readonly="schema.readonly")
input.form-control.file(type="file", v-if="schema.browse !== false", :disabled="disabled", @change="fileChanged")
.preview(:style="previewStyle")
.remove(title="Remove image", @click="remove")
Expand Down
13 changes: 13 additions & 0 deletions test/unit/specs/fields/fieldImage.spec.js
Expand Up @@ -117,6 +117,19 @@ describe("fieldImage.vue", function() {
});
});

it("should not show the link input element if hideInput is true", (done) => {
vm.$set("schema.hideInput", true);

vm.$nextTick( () => {
let fileInput = el.querySelector("input[type=text]");
expect(fileInput.style.display).to.be.equal("none");

// Restore
vm.$set("schema.hideInput", false);
done();
});
});

it("should not show base64 data in input field", (done) => {
model.avatar = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ";

Expand Down

0 comments on commit deb4ec5

Please sign in to comment.