getComputedStyle for the element when its parent is focusedIs there a CSS parent selector?How can I select an element with multiple classes in jQuery?CSS selector for first element with classCleaner way to change focus on child components in ReactPass data from child to parent in ReactCSS isn't applied as expected in React Native when parent component already has styles definedWhy Does React Render Children Before Parents?SCSS in React - Parent styles overriding child stylesFocus and tabIndex for React popupIs this a “global” :focus selector in Chrome? Can I overwrite it?
Vegetarian dishes on Russian trains (European part)
Is there a utility / method to organize trad gear so that each piece is immediately accessible?
Nicely-spaced multiple choice options
Why do aircraft leave cruising altitude long before landing just to circle?
Did Michelle Obama have a staff of 23 people, while Melania has a staff of 4?
Photoshop older default brushes
Unsolved Problems due to Lack of Computational Power
Show two plots together: a two dimensional curve tangent to the maxima of a three dimensional plot
Do living authors still get paid royalties for their old work?
What happened after the end of the Truman Show?
Meaning and structure of headline "Hair it is: A List of ..."
Airline power sockets shut down when I plug my computer in. How can I avoid that?
Number of matrices with bounded products of rows and columns
Quick destruction of a helium filled airship?
What's the point of writing that I know will never be used or read?
Outer Class can have how many inner class(es)
My new Acer Aspire 7 doesn't have a Legacy Boot option, what can I do to get it?
Can you find the next number in the following series?
Polar contour plot in Mathematica?
Spongy green glass found on graves
!I!n!s!e!r!t! !b!e!t!w!e!e!n!
Rotate List by K places
Eric Andre had a dream
Why is su world executable?
getComputedStyle for the element when its parent is focused
Is there a CSS parent selector?How can I select an element with multiple classes in jQuery?CSS selector for first element with classCleaner way to change focus on child components in ReactPass data from child to parent in ReactCSS isn't applied as expected in React Native when parent component already has styles definedWhy Does React Render Children Before Parents?SCSS in React - Parent styles overriding child stylesFocus and tabIndex for React popupIs this a “global” :focus selector in Chrome? Can I overwrite it?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a parent which sets a style for the children when it is focused. Which works perfectly when I compile my react project.
I am using react emotion, but it does not matter, because in the end I have usual css.
const parentStyle = css`
:focus
#child
border: 2px solid blue !important;
`;
I want to get from within child element the border style.
I am using jest to test this and I tried something like this.
parent.simulate('focus');
const childNode = wrapper.find("#child");
const computedStyles = window.getComputedStyle(childNode);
expect(computedStyles.getPropertyValue('border')).toBe('2px solid blue');
So the expect is failing, it is not getting the border style.
reactjs css-selectors emotion getcomputedstyle
add a comment |
I have a parent which sets a style for the children when it is focused. Which works perfectly when I compile my react project.
I am using react emotion, but it does not matter, because in the end I have usual css.
const parentStyle = css`
:focus
#child
border: 2px solid blue !important;
`;
I want to get from within child element the border style.
I am using jest to test this and I tried something like this.
parent.simulate('focus');
const childNode = wrapper.find("#child");
const computedStyles = window.getComputedStyle(childNode);
expect(computedStyles.getPropertyValue('border')).toBe('2px solid blue');
So the expect is failing, it is not getting the border style.
reactjs css-selectors emotion getcomputedstyle
What is your question? :)
– Webber
Mar 27 at 14:14
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
What ischildNodeset to?
– Webber
Mar 27 at 14:28
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
1
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35
add a comment |
I have a parent which sets a style for the children when it is focused. Which works perfectly when I compile my react project.
I am using react emotion, but it does not matter, because in the end I have usual css.
const parentStyle = css`
:focus
#child
border: 2px solid blue !important;
`;
I want to get from within child element the border style.
I am using jest to test this and I tried something like this.
parent.simulate('focus');
const childNode = wrapper.find("#child");
const computedStyles = window.getComputedStyle(childNode);
expect(computedStyles.getPropertyValue('border')).toBe('2px solid blue');
So the expect is failing, it is not getting the border style.
reactjs css-selectors emotion getcomputedstyle
I have a parent which sets a style for the children when it is focused. Which works perfectly when I compile my react project.
I am using react emotion, but it does not matter, because in the end I have usual css.
const parentStyle = css`
:focus
#child
border: 2px solid blue !important;
`;
I want to get from within child element the border style.
I am using jest to test this and I tried something like this.
parent.simulate('focus');
const childNode = wrapper.find("#child");
const computedStyles = window.getComputedStyle(childNode);
expect(computedStyles.getPropertyValue('border')).toBe('2px solid blue');
So the expect is failing, it is not getting the border style.
reactjs css-selectors emotion getcomputedstyle
reactjs css-selectors emotion getcomputedstyle
edited Mar 27 at 14:29
Alexandr Zavalii
asked Mar 27 at 13:59
Alexandr ZavaliiAlexandr Zavalii
1,0609 silver badges25 bronze badges
1,0609 silver badges25 bronze badges
What is your question? :)
– Webber
Mar 27 at 14:14
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
What ischildNodeset to?
– Webber
Mar 27 at 14:28
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
1
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35
add a comment |
What is your question? :)
– Webber
Mar 27 at 14:14
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
What ischildNodeset to?
– Webber
Mar 27 at 14:28
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
1
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35
What is your question? :)
– Webber
Mar 27 at 14:14
What is your question? :)
– Webber
Mar 27 at 14:14
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
What is
childNode set to?– Webber
Mar 27 at 14:28
What is
childNode set to?– Webber
Mar 27 at 14:28
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
1
1
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55379055%2fgetcomputedstyle-for-the-element-when-its-parent-is-focused%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55379055%2fgetcomputedstyle-for-the-element-when-its-parent-is-focused%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is your question? :)
– Webber
Mar 27 at 14:14
@Webber sorry, just updated. my expect function is not working, its not getting style of the border
– Alexandr Zavalii
Mar 27 at 14:27
What is
childNodeset to?– Webber
Mar 27 at 14:28
updated again :)
– Alexandr Zavalii
Mar 27 at 14:29
1
Hmm, have you tried the longhand names? See first note in the documentation of computedStyles
– Webber
Mar 27 at 14:35