|
|
@@ -1,11 +1,11 @@
|
|
|
import { config, DOMWrapper, mount } from '@vue/test-utils';
|
|
|
import FixedNav from '../index.vue';
|
|
|
import { nextTick } from 'vue';
|
|
|
-import NutIcon from '../../icon/index.vue';
|
|
|
+import { Left } from '@nutui/icons-vue';
|
|
|
import nutOverlay from '../../overlay/index.vue';
|
|
|
beforeAll(() => {
|
|
|
config.global.components = {
|
|
|
- NutIcon,
|
|
|
+ Left,
|
|
|
nutOverlay
|
|
|
};
|
|
|
});
|
|
|
@@ -14,9 +14,9 @@ afterAll(() => {
|
|
|
config.global.components = {};
|
|
|
});
|
|
|
describe('FixedNav', () => {
|
|
|
- test('base nut-fixednav', () => {
|
|
|
+ test('base nut-fixed-nav', () => {
|
|
|
const wrapper = mount(FixedNav);
|
|
|
- const rate = wrapper.find('.nut-fixednav');
|
|
|
+ const rate = wrapper.find('.nut-fixed-nav');
|
|
|
expect(rate.exists()).toBe(true);
|
|
|
});
|
|
|
|
|
|
@@ -27,7 +27,7 @@ describe('FixedNav', () => {
|
|
|
overlay: true
|
|
|
}
|
|
|
});
|
|
|
- const _html: DOMWrapper<Element> = wrapper.find('.nut-fixednav__list');
|
|
|
+ const _html: DOMWrapper<Element> = wrapper.find('.nut-fixed-nav__list');
|
|
|
expect(_html.exists()).toBe(true);
|
|
|
});
|
|
|
test('should be displayed after setting the type', () => {
|
|
|
@@ -49,9 +49,9 @@ describe('FixedNav', () => {
|
|
|
});
|
|
|
const _html1 = wrapper.find('.nut-overlay');
|
|
|
expect(_html1.exists()).toBe(true);
|
|
|
- const _html = wrapper.find('.nut-fixednav__btn');
|
|
|
+ const _html = wrapper.find('.nut-fixed-nav__btn');
|
|
|
expect(_html.html()).toContain('展开');
|
|
|
- wrapper.find('.nut-fixednav__btn').trigger('click');
|
|
|
+ wrapper.find('.nut-fixed-nav__btn').trigger('click');
|
|
|
await nextTick();
|
|
|
expect(wrapper.emitted('update:visible')![0]).toEqual([true]);
|
|
|
});
|
|
|
@@ -62,7 +62,7 @@ describe('FixedNav', () => {
|
|
|
position: { top: '210px' }
|
|
|
}
|
|
|
});
|
|
|
- const _html = wrapper.find('.nut-fixednav');
|
|
|
+ const _html = wrapper.find('.nut-fixed-nav');
|
|
|
expect((_html.element as HTMLElement).style.top).toBe('210px');
|
|
|
});
|
|
|
});
|