primevue-mirror/components/styleclass/StyleClass.spec.js

37 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import { config, mount } from '@vue/test-utils';
2022-12-08 14:13:16 +00:00
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
2022-09-06 12:03:37 +00:00
import StyleClass from './StyleClass';
config.global.directives = {
2022-09-14 11:26:01 +00:00
styleclass: StyleClass
};
2022-09-06 12:03:37 +00:00
describe('StyleClass', () => {
it('should work with next selector', async () => {
const wrapper = mount({
template: `
<Button label="Toggle p-disabled" v-styleclass="{ selector: '@next', toggleClass: 'p-disabled' }" />
<InputText class="block mt-3" />
`,
components: {
Button,
InputText
}
});
const button = wrapper.find('.p-button');
const input = wrapper.find('.p-inputtext');
expect(input.classes()).not.toContain('p-disabled');
await button.trigger('click');
expect(input.classes()).toContain('p-disabled');
await button.trigger('click');
expect(input.classes()).not.toContain('p-disabled');
});
2022-09-14 11:26:01 +00:00
});