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;








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.










share|improve this question


























  • 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 childNode set 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

















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.










share|improve this question


























  • 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 childNode set 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













0












0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 is childNode set 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











  • @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











  • 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












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
);



);













draft saved

draft discarded


















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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해