Skip to content
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

Check style changes on hover #2084

Open
FanilZarip opened this issue Nov 12, 2023 · 1 comment
Open

Check style changes on hover #2084

FanilZarip opened this issue Nov 12, 2023 · 1 comment

Comments

@FanilZarip
Copy link

Feature Description

Hi!
Provide a check and get changed css color or etc rules on element hover

Problem

I have css rules
before hover
.button[data-v-14f27f51] {
background-color: var(--14f27f51-backgroundColor);
padding: 10px 30px;
border: none;
color: var(--14f27f51-color);
cursor: pointer;
}

after hover has addintional rules

.button[data-v-14f27f51]:hover {
filter: brightness(1.2);
}

Expected behaviour

after await wrapper.trigger("hover") or await wrapper.trigger("mouseover")
Getting access to css rules on hover

Alternatives

What are the alternative solutions? Please describe what else you have considered?

@BeatsuDev
Copy link

BeatsuDev commented Feb 21, 2024

I tried this, but it didn't work. The test fails because the expression is not truthy.



    it("Button changes colour on hover", async () => {
        const wrapper = mount(ButtonComponent);

        const styleBefore = getComputedStyle(wrapper.element);
        wrapper.trigger("mouseover");
        await wrapper.vm.$nextTick();
        const styleAfter = getComputedStyle(wrapper.element);

        expect(
            styleBefore.backgroundColor !== styleAfter.backgroundColor
        ).toBeTruthy();
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants