-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/lite 29476 create menu component #48
Feature/lite 29476 create menu component #48
Conversation
Quality Gate passedIssues Measures |
const showMenu = ref(false) | ||
const menu = ref(null) | ||
|
||
const toggle = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These mutations are like some hooks under the hood, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just syntax for writing method in composition API (opposed to option API that we are used to see more :))
it('toggles menu to true when clicking', () => { | ||
const wrapper = mount(Menu); | ||
wrapper.vm.showMenu = false; | ||
wrapper.vm.toggle(wrapper.vm.showMenu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fyi, dom events can be triggered directly instead of calling the fn attached to the listener.
Eg: wrapper.find('.menu-trigger').trigger('click');
will trigger the event listener, calling your function. You could check then that the 'menu-content' element is rendered as a consequence instead of checking the variable's value. Eg: expect(wrapper.find('.menu-content').exists()).toBeTruthy()
No need to change, just a different type of test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I will leave it as it is and try to use this way when appropriate in the future :)
Added basic version of menu component
Both the button and container for item are customisable, as they are just plain slot elements (so the styles here are of course not important:) )