Commit 4f925cd5 authored by Clement Ho's avatar Clement Ho Committed by Phil Hughes

Harmonize can-attach-file to match CE

parent d64dd2b9
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
type: String, type: String,
required: true, required: true,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
enableAutocomplete: { enableAutocomplete: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -42,6 +47,7 @@ ...@@ -42,6 +47,7 @@
<markdown-field <markdown-field
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:can-attach-file="canAttachFile"
:enable-autocomplete="enableAutocomplete" :enable-autocomplete="enableAutocomplete"
> >
<textarea <textarea
......
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
required: false, required: false,
default: true, default: true,
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
enableAutocomplete: { enableAutocomplete: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -92,6 +97,7 @@ ...@@ -92,6 +97,7 @@
:form-state="formState" :form-state="formState"
:markdown-preview-path="markdownPreviewPath" :markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:can-attach-file="canAttachFile"
:enable-autocomplete="enableAutocomplete" :enable-autocomplete="enableAutocomplete"
/> />
<edit-actions <edit-actions
......
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
required: false, required: false,
default: '', default: '',
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
enableAutocomplete: { enableAutocomplete: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -139,6 +144,7 @@ ...@@ -139,6 +144,7 @@
<markdown-toolbar <markdown-toolbar
:markdown-docs-path="markdownDocsPath" :markdown-docs-path="markdownDocsPath"
:quick-actions-docs-path="quickActionsDocsPath" :quick-actions-docs-path="quickActionsDocsPath"
:can-attach-file="canAttachFile"
/> />
</div> </div>
</div> </div>
......
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
required: false, required: false,
default: '', default: '',
}, },
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
}, },
computed: { computed: {
hasQuickActionsDocsPath() { hasQuickActionsDocsPath() {
...@@ -50,7 +55,10 @@ ...@@ -50,7 +55,10 @@
are supported are supported
</template> </template>
</div> </div>
<span class="uploading-container"> <span
v-if="canAttachFile"
class="uploading-container"
>
<span class="uploading-progress-container hide"> <span class="uploading-progress-container hide">
<i <i
class="fa fa-file-image-o toolbar-button-icon" class="fa fa-file-image-o toolbar-button-icon"
......
import Vue from 'vue';
import toolbar from '~/vue_shared/components/markdown/toolbar.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('toolbar', () => {
let vm;
const Toolbar = Vue.extend(toolbar);
const props = {
markdownDocsPath: '',
};
afterEach(() => {
vm.$destroy();
});
describe('user can attach file', () => {
beforeEach(() => {
vm = mountComponent(Toolbar, props);
});
it('should render uploading-container', () => {
expect(vm.$el.querySelector('.uploading-container')).not.toBeNull();
});
});
describe('user cannot attach file', () => {
beforeEach(() => {
vm = mountComponent(Toolbar, Object.assign({}, props, {
canAttachFile: false,
}));
});
it('should not render uploading-container', () => {
expect(vm.$el.querySelector('.uploading-container')).toBeNull();
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment