<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Paula Penedo (she/her)</title>
    <description>The latest articles on Forem by Paula Penedo (she/her) (@paulinhapenedo).</description>
    <link>https://forem.com/paulinhapenedo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F25116%2F9422229c-c01b-454e-9bad-617fb61ef836.jpg</url>
      <title>Forem: Paula Penedo (she/her)</title>
      <link>https://forem.com/paulinhapenedo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/paulinhapenedo"/>
    <language>en</language>
    <item>
      <title>Testing Next.js 13 App Router architecture is... complicated</title>
      <dc:creator>Paula Penedo (she/her)</dc:creator>
      <pubDate>Wed, 13 Sep 2023 16:02:19 +0000</pubDate>
      <link>https://forem.com/paulinhapenedo/testing-nextjs-13-app-router-architecture-is-complicated-23kn</link>
      <guid>https://forem.com/paulinhapenedo/testing-nextjs-13-app-router-architecture-is-complicated-23kn</guid>
      <description>&lt;p&gt;I've been trying to get back into coding daily and decided to start a side project using Next.js 13 new &lt;a href="https://nextjs.org/docs/app/building-your-application/routing#the-app-router"&gt;&lt;strong&gt;App Router&lt;/strong&gt;&lt;/a&gt; architecture — instead of the previous &lt;strong&gt;Pages Router&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The first red flag 🚩 I noticed was that there's no &lt;strong&gt;Testing&lt;/strong&gt; documentation on the App Router docs. The second red flag 🚩 was that none of the examples in their GitHub repo, including the &lt;code&gt;with-jest&lt;/code&gt; &lt;a href="https://github.com/vercel/next.js/tree/canary/examples/with-jest"&gt;template&lt;/a&gt; updated in the first week of September 2023, has any examples of testing &lt;a href="https://nextjs.org/docs/app/building-your-application/rendering/server-components"&gt;React Server Components&lt;/a&gt; which is the new paradigm the Vercel team is using in the &lt;strong&gt;App Router&lt;/strong&gt; architecture.&lt;/p&gt;

&lt;p&gt;When trying to test a RSC, React Testing Library throws an error &lt;code&gt;NEXT_RSC_ERR_CLIENT_IMPORT&lt;/code&gt; as seen on this &lt;a href="https://github.com/vercel/next.js/issues/47448"&gt;issue&lt;/a&gt; from May 2023. The Next.js team posted in early September 2023 that the canary version &lt;code&gt;v13.4.20-canary.16&lt;/code&gt; fixes this error.&lt;/p&gt;

&lt;p&gt;I've installed this canary version, and now the RSC I'm trying to test are returning &lt;code&gt;Objects are not valid as a React child (found: [object Promise])&lt;/code&gt;. Yep, that's right: React Server Components can be async. They are safe to be async since they render on the server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want to know more about React Server Components, I recommend checking Josh Comeau's excellent post about it: &lt;a href="https://www.joshwcomeau.com/react/server-components/"&gt;https://www.joshwcomeau.com/react/server-components/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Who isn't ready yet to test rendering async components? React Testing Library.
&lt;/h2&gt;

&lt;p&gt;As more and more people jump in the Vercel hype train, RTL maintainers had to come with &lt;a href="https://github.com/testing-library/react-testing-library/issues/1209#issuecomment-1569813305"&gt;workarounds&lt;/a&gt; to support that while they &lt;a href="https://github.com/vercel/next.js/discussions/50479"&gt;try to reach the Vercel team&lt;/a&gt; to work together in a solution. Having an issue created in May 2023 without any response or emoji reaction from the Vercel team is unsettling.&lt;/p&gt;

&lt;p&gt;The bottom line is that Vercel promoted to stable a "meta-framework" that comes short when handling unit testing coverage. I spent a day searching GitHub issues and connecting the dots from different repositories.&lt;/p&gt;

&lt;p&gt;No one is warning developers about it or explicitly recommending creating or enhancing their end-to-end tests using Cypress or Playwright if they want to test their components. However, that's the solution maintainers are giving to their users.&lt;/p&gt;

&lt;h2&gt;
  
  
  DX in detriment of quality?
&lt;/h2&gt;

&lt;p&gt;What kind of message do meta-frameworks and libraries give to developers when they do such a thing? We already have non-semantic and inaccessible code propagated everywhere in docs, courses, and presentations.&lt;/p&gt;

&lt;p&gt;We should worry about the code we put as a standard in our documentation and examples. Web semantics, accessibility, and testing should be part of the Definition of Done (DoD) of every code we write, not an afterthought.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>next13</category>
      <category>testing</category>
      <category>react</category>
    </item>
    <item>
      <title>Jest JSDOM data-attribute</title>
      <dc:creator>Paula Penedo (she/her)</dc:creator>
      <pubDate>Fri, 14 Aug 2020 03:37:18 +0000</pubDate>
      <link>https://forem.com/paulinhapenedo/jest-jsdom-data-attribute-2j6a</link>
      <guid>https://forem.com/paulinhapenedo/jest-jsdom-data-attribute-2j6a</guid>
      <description>&lt;p&gt;When using &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt; with JSDOM to test HTML elements, it's common to try to use or access the &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes"&gt;data-attribute&lt;/a&gt;. The problem is that it &lt;a href="https://github.com/jsdom/jsdom/issues/961"&gt;doesn't work&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The solution is quite simple: &lt;code&gt;getAttribute&lt;/code&gt; / &lt;code&gt;setAttribute&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-food&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;taco&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-food&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// returns 'taco'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>todayilearned</category>
      <category>javascript</category>
      <category>testing</category>
    </item>
    <item>
      <title>Change the text color of an input field with an autocompleted value</title>
      <dc:creator>Paula Penedo (she/her)</dc:creator>
      <pubDate>Thu, 30 Jul 2020 22:00:59 +0000</pubDate>
      <link>https://forem.com/paulinhapenedo/change-the-text-color-of-an-input-field-with-an-autocompleted-value-2b8</link>
      <guid>https://forem.com/paulinhapenedo/change-the-text-color-of-an-input-field-with-an-autocompleted-value-2b8</guid>
      <description>&lt;p&gt;Webkit-based browsers have some CSS properties that are only accessible with the &lt;code&gt;-webkit-&lt;/code&gt; prefix. One of these properties is &lt;code&gt;-webkit-text-fill-color&lt;/code&gt;. It sets the color for the input field even when your browser uses &lt;code&gt;autofill&lt;/code&gt; feature. You may have encountered something like this: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F29180903%2F45598858-33d85b80-b9b0-11e8-84d1-b2db8bced8d0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F29180903%2F45598858-33d85b80-b9b0-11e8-84d1-b2db8bced8d0.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is your browser telling you that this information was autofilled by it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-webkit-text-fill-color&lt;/code&gt; has a higher hierarchy in the Cascading than our regular &lt;code&gt;color&lt;/code&gt;, even if you use &lt;code&gt;important&lt;/code&gt;. So if your input has a color different than black and you need to overwrite the browser's default, you may want to use &lt;code&gt;-webkit-text-fill-color&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="nl"&gt;-webkit-text-fill-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;Learn more at the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-fill-color" rel="noopener noreferrer"&gt;MDN Documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>css</category>
    </item>
    <item>
      <title>Angular 8 and IE 11</title>
      <dc:creator>Paula Penedo (she/her)</dc:creator>
      <pubDate>Thu, 29 Aug 2019 18:33:36 +0000</pubDate>
      <link>https://forem.com/paulinhapenedo/angular-8-and-ie-11-1ed2</link>
      <guid>https://forem.com/paulinhapenedo/angular-8-and-ie-11-1ed2</guid>
      <description>&lt;p&gt;It's a funny thing that my first post on Dev.to will be about Angular, a framework that I have close to zero experience.&lt;/p&gt;

&lt;p&gt;I've switched careers early 2010, after a few years working with advertising and marketing, so I didn't catch the breaking change on the web development world with the rise of frameworks like Backbone and Angular. My first job working with the web was all about WordPress themes and the beloved jQuery (which I really miss).&lt;/p&gt;

&lt;p&gt;Anyway, sorry for the little detour and onto what really matters! On the previous versions of Angular, we had to install &lt;a href="https://github.com/zloirock/core-js"&gt;core-js&lt;/a&gt; and import a bunch of its features/helpers, making your &lt;code&gt;polyfill.ts&lt;/code&gt; look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** IE9, IE10 and IE11 requires all of the following polyfills. **/&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/symbol&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/parse-int&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/parse-float&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/math&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/regexp&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;core-js/es6/map&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Angular 8 comes with &lt;a href="https://github.com/zloirock/core-js"&gt;core-js&lt;/a&gt; installed by default. It will be added to our bundle &lt;strong&gt;only&lt;/strong&gt; if we tell Angular to do that.  &lt;/p&gt;

&lt;h2&gt;
  
  
  How do we do that?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;tsConfig.json&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="c1"&gt;// the default configuration&lt;/span&gt;
 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;target&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;es2015&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

 &lt;span class="c1"&gt;// the change&lt;/span&gt;
 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;target&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;es5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;code&gt;polyfills.ts&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** IE10 and IE11 requires the following for NgClass support on SVG elements */&lt;/span&gt;
 &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;classlist.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Run `npm install --save classlist.js`.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;code&gt;browserslist&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt; # the default configuration
 not IE 9-11

 # the change - remove the "not"
 IE 9-11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bonus tip
&lt;/h2&gt;

&lt;p&gt;If you are going to use SVGs sprites and the tag &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt;, IE 11 will complain about it too. Luckily there's a lib to solve that, the amazing &lt;a href="https://github.com/jonathantneal/svg4everybody"&gt;svg4everybody&lt;/a&gt;. Add it to your &lt;code&gt;polyfills.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** IE10 and IE11 requires the following for external source of SVG when using &amp;lt;use&amp;gt; tag */&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;svg4everybody&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svg4everybody&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;svg4everybody&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;polyfill&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Feel free to drop a comment if you have any other tips and strategies for developers working with Angular 8!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>ie11</category>
    </item>
  </channel>
</rss>
