Commit 092c8d09 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch '301143-add-missing-inherit-attrs-false' into 'master'

Add missing inheritAttrs: false

See merge request gitlab-org/gitlab!62170
parents cf8774d0 07b08ec2
...@@ -10,6 +10,7 @@ export default { ...@@ -10,6 +10,7 @@ export default {
TopNavMenuItem, TopNavMenuItem,
VuexModuleProvider, VuexModuleProvider,
}, },
inheritAttrs: false,
props: { props: {
frequentItemsVuexModule: { frequentItemsVuexModule: {
type: String, type: String,
......
...@@ -23,13 +23,14 @@ const TEST_OTHER_PROPS = { ...@@ -23,13 +23,14 @@ const TEST_OTHER_PROPS = {
describe('~/nav/components/top_nav_container_view.vue', () => { describe('~/nav/components/top_nav_container_view.vue', () => {
let wrapper; let wrapper;
const createComponent = (props = {}) => { const createComponent = (props = {}, options = {}) => {
wrapper = shallowMount(TopNavContainerView, { wrapper = shallowMount(TopNavContainerView, {
propsData: { propsData: {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
...TEST_OTHER_PROPS, ...TEST_OTHER_PROPS,
...props, ...props,
}, },
...options,
}); });
}; };
...@@ -44,6 +45,7 @@ describe('~/nav/components/top_nav_container_view.vue', () => { ...@@ -44,6 +45,7 @@ describe('~/nav/components/top_nav_container_view.vue', () => {
return { return {
vuexModule: parent.props('vuexModule'), vuexModule: parent.props('vuexModule'),
props: parent.findComponent(FrequentItemsApp).props(), props: parent.findComponent(FrequentItemsApp).props(),
attributes: parent.findComponent(FrequentItemsApp).attributes(),
}; };
}; };
...@@ -67,14 +69,23 @@ describe('~/nav/components/top_nav_container_view.vue', () => { ...@@ -67,14 +69,23 @@ describe('~/nav/components/top_nav_container_view.vue', () => {
); );
describe('default', () => { describe('default', () => {
const EXTRA_ATTRS = { 'data-test-attribute': 'foo' };
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent({}, { attrs: EXTRA_ATTRS });
});
it('does not inherit extra attrs', () => {
expect(wrapper.attributes()).toEqual({
class: expect.any(String),
});
}); });
it('renders frequent items app', () => { it('renders frequent items app', () => {
expect(findFrequentItemsApp()).toEqual({ expect(findFrequentItemsApp()).toEqual({
vuexModule: DEFAULT_PROPS.frequentItemsVuexModule, vuexModule: DEFAULT_PROPS.frequentItemsVuexModule,
props: TEST_OTHER_PROPS, props: TEST_OTHER_PROPS,
attributes: expect.objectContaining(EXTRA_ATTRS),
}); });
}); });
......
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