diff --git a/client/src/components/DatasetInformation/DatasetAttributes.test.js b/client/src/components/DatasetInformation/DatasetAttributes.test.js index 7862c91da571..4822815f3805 100644 --- a/client/src/components/DatasetInformation/DatasetAttributes.test.js +++ b/client/src/components/DatasetInformation/DatasetAttributes.test.js @@ -33,6 +33,31 @@ async function buildWrapper(conversion_disable = false) { return wrapper; } +async function buildWrapperWithError(error) { + const wrapper = mount(DatasetAttributes, { + propsData: { + datasetId: "dataset_id", + messageText: error, + messageVariant: "danger", + }, + computed: { + hasError() { + return true; + }, + }, + localVue, + stubs: { + DatasetAttributesProvider: MockProvider({ + result: null, + }), + FontAwesomeIcon: false, + FormElement: false, + }, + }); + await flushPromises(); + return wrapper; +} + describe("DatasetAttributes", () => { it("check rendering", async () => { const axiosMock = new MockAdapter(axios); @@ -61,4 +86,15 @@ describe("DatasetAttributes", () => { expect(wrapper.findAll(".tab-pane").length).toBe(3); expect(wrapper.findAll(".ui-portlet-section").length).toBe(1); }); + + it("doesn't render edit controls with error", async () => { + const wrapper = await buildWrapperWithError("error"); + expect(wrapper.findAll("button").length).toBe(0); + expect(wrapper.findAll("#attribute_text").length).toBe(0); + expect(wrapper.findAll("#conversion_text").length).toBe(0); + expect(wrapper.findAll("#datatype_text").length).toBe(0); + expect(wrapper.findAll("#permission_text").length).toBe(0); + expect(wrapper.findAll(".tab-pane").length).toBe(0); + expect(wrapper.findAll(".ui-portlet-section").length).toBe(0); + }); }); diff --git a/client/src/components/DatasetInformation/DatasetAttributes.vue b/client/src/components/DatasetInformation/DatasetAttributes.vue index e197e126b6a9..eef869f1e405 100644 --- a/client/src/components/DatasetInformation/DatasetAttributes.vue +++ b/client/src/components/DatasetInformation/DatasetAttributes.vue @@ -5,7 +5,7 @@ {{ messageText | l }} -
+