56 lines
No EOL
1.1 KiB
JavaScript
56 lines
No EOL
1.1 KiB
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import alert from "./alert";
|
|
|
|
describe("alert.vue", () => {
|
|
|
|
it("Should add class 'alert-dismissible' if isDismissible is true", async () => {
|
|
// Arrange
|
|
const wrapper = shallowMount(alert, {
|
|
propsData: {
|
|
isDismissible: true
|
|
},
|
|
computed: {
|
|
splitAlertCopyForLink: {
|
|
get() {
|
|
return "TEST";
|
|
},
|
|
}
|
|
},
|
|
mixins: [mockMixin]
|
|
});
|
|
|
|
const wrapperDiv = wrapper.find('div');
|
|
|
|
// Assert
|
|
expect(wrapperDiv.classes()).toContain('alert-dismissible')
|
|
});
|
|
|
|
it("Should add specified alert class", async () => {
|
|
// Arrange
|
|
const wrapper = shallowMount(alert, {
|
|
propsData: {
|
|
alertClass: 'warning'
|
|
},
|
|
computed: {
|
|
splitAlertCopyForLink: {
|
|
get() {
|
|
return "TEST";
|
|
},
|
|
}
|
|
},
|
|
mixins: [mockMixin]
|
|
});
|
|
|
|
const wrapperDiv = wrapper.find('div');
|
|
|
|
// Assert
|
|
expect(wrapperDiv.classes()).toContain('warning')
|
|
});
|
|
|
|
});
|
|
|
|
const mockMixin = {
|
|
methods: {
|
|
getCmsContent: jest.fn()
|
|
}
|
|
} |