<?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: Diede Gulpers</title>
    <description>The latest articles on Forem by Diede Gulpers (@diede).</description>
    <link>https://forem.com/diede</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%2F409346%2F73f79677-1974-4557-a115-4e63b96a7052.png</url>
      <title>Forem: Diede Gulpers</title>
      <link>https://forem.com/diede</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/diede"/>
    <language>en</language>
    <item>
      <title>Thinking about JS front-end testing</title>
      <dc:creator>Diede Gulpers</dc:creator>
      <pubDate>Mon, 28 Aug 2023 08:07:43 +0000</pubDate>
      <link>https://forem.com/diede/thinking-about-js-front-end-testing-3lpk</link>
      <guid>https://forem.com/diede/thinking-about-js-front-end-testing-3lpk</guid>
      <description>&lt;p&gt;Currently I am working on a Vue component library which can use some testing. Since Vue components always form a wonderful mix of JS, HTML and CSS it is harder to me to think about testing them the way I would in PHP. &lt;/p&gt;

&lt;p&gt;Because in PHP I often can use a very clear cut setup of testing the public functions of a class and can easily mock out the dependecies by injections. I can quite easily hold on to the concept of Unit testing as a basis for my tests.&lt;/p&gt;

&lt;p&gt;In Vue components I believe all I should do is consider all my work to be intergration testing rather then unit testing. My main arguments for this are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My templating logic, like the &lt;code&gt;v-if&lt;/code&gt; and &lt;code&gt;v-for&lt;/code&gt;, heavily define the logical paths and can't be turned into seperate units/functions.&lt;/li&gt;
&lt;li&gt;My JS logic should not be turned into seperate files or composables just for testing purposes if it is more logical or practical to keep it in the component. what I consider logical or practical reasons to seperate code is when you want to use it in at least two places or when you can keep a better overview of what is happing in the component. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To me it becomes easier to reason about all my components as intergration tests, that at the very least combine three languages and in most cases also include dependencies in JS in the form of packages, composables or child components. &lt;/p&gt;

&lt;p&gt;This thinking makes it easier for me to review my code prior to writing tests. I now skim them for what I would consider a &lt;code&gt;Unit&lt;/code&gt; and then write a few tests per &lt;code&gt;Unit&lt;/code&gt; in a intregration testsuite instead of pulling apart a nice component and testing every function. &lt;br&gt;
What I consider a &lt;code&gt;Unit&lt;/code&gt; is more then the specific &lt;code&gt;function&lt;/code&gt; or &lt;code&gt;() =&amp;gt;&lt;/code&gt; we use in JS. Every logical fork can be considered a &lt;code&gt;Unit&lt;/code&gt; and I just make a educated guess about which of those forks are important. If I have a &lt;code&gt;v-if&lt;/code&gt; on a prop boolean that shows or hides text I tend not to test it, because by reading the code I am already a 100% certain it will work. But if I have a &lt;code&gt;v-if&lt;/code&gt; that if the boolean is true is depended on other props to exist to show an output I am more likely to test it. &lt;br&gt;
Basically I try to look for "meaningful intersections" within all the logical paths that exist in my code. &lt;/p&gt;

&lt;p&gt;Does my reasoning make sense to you? Or do you believe I am wrong in thinking that components should always be viewed as intergration tests? I would like to hear a different take on the topic. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>discuss</category>
      <category>testing</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Shy-phen! the best named HTML character entity!</title>
      <dc:creator>Diede Gulpers</dc:creator>
      <pubDate>Wed, 05 Apr 2023 12:31:05 +0000</pubDate>
      <link>https://forem.com/diede/shy-phen-the-best-named-html-character-entity-4dhg</link>
      <guid>https://forem.com/diede/shy-phen-the-best-named-html-character-entity-4dhg</guid>
      <description>&lt;p&gt;This is a celebration post of the seldomly seen  HTML character entity that should get more appreciation: the &lt;strong&gt;shy-phen&lt;/strong&gt;. Its not for its function that we celebrate it, but for its perfectly fitting Entity encoding. &lt;/p&gt;

&lt;p&gt;I was working on a &lt;a href="https://cell-0.com/blog/digitale-toegankelijkheid"&gt;Dutch in-depth blog post about Accessibility&lt;/a&gt; and I wanted to hyphenate words only once the screen would become to small. &lt;/p&gt;

&lt;p&gt;Before celebrating the &lt;strong&gt;shy-phen&lt;/strong&gt; lets first talk about what we are looking at here. We are looking at a &lt;em&gt;HTML character entity reference&lt;/em&gt;. Which is a wild ride on its own. &lt;/p&gt;

&lt;p&gt;The references have come to exist do to a simple problem: we have to many characters in different languages and different fields of expertise to fit them all nicely on a keyboard.&lt;/p&gt;

&lt;p&gt;That's why over time we have come up with many standards that describe sets of characters and how to encode them. The leading standard for describing characters right now is &lt;a href="https://www.unicode.org/charts/"&gt;Unicode&lt;/a&gt;, which describes 149,186 unique characters and has 1177 new characters on its for ever growing &lt;a href="https://www.unicode.org/alloc/Pipeline.html"&gt;waiting list&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Currently HTML supports &lt;a href="https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references"&gt;at least 2231 by name&lt;/a&gt; of these characters, although you do best to check if any character you &lt;a href="https://mothereff.in/html-entities#%E2%9C%BE%20%F0%9F%99%80%20%E2%9C%8C"&gt;want to use actually is supported.&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;See how I use, "by name"? This has everything to do with the fact that we have 3,75 ways to write down a HTML entity reference in HTML! We can target them as numeric character reference, a hexadecimal numeric character reference, a hexadecimal numeric character reference without leading zero's (I am counting it as 0,5 way) and a character entity reference, and some character entities may omit the &lt;code&gt;;&lt;/code&gt; (counting it as 0,25 way). &lt;/p&gt;

&lt;p&gt;Lets take the yen &lt;code&gt;¥&lt;/code&gt; as an example we can write it as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;#165; 
&amp;amp;#x00A5; 
&amp;amp;#xA5; 
&amp;amp;yen;  
&amp;amp;yen 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://mothereff.in/html-entities#%C2%A5%20%0A%C2%A5%20%0A%C2%A5%20%0A%C2%A5%20%20%0A%C2%A5%20"&gt;all of them are valid.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, why so many notations? Both the hexadecimal and decimal notation now work in HTML but older versions of HTML only supported decimal notation (Unicode itself seems to have used hexadecimal notation since version 1.0.0). &lt;/p&gt;

&lt;p&gt;The character entity notation is &lt;a href="https://www.w3.org/TR/1998/REC-html40-19980424/charset.html#h-5.3.2"&gt;mentioned in html 4.0&lt;/a&gt; as being a way to more easily remember encodings by name then by numbers. It seems to be the main introduction to the named entities and it started out with 96 entities.&lt;br&gt;&lt;br&gt;
Its current list concluded it was &lt;a href="https://github.com/whatwg/html/blob/main/FAQ.md#html-should-add-more-named-character-references"&gt;no longer desirable to keep adding new entities&lt;/a&gt;, having grown to 2231 entities it is considered it will introduce more risks and little value. &lt;/p&gt;

&lt;p&gt;Now why would we celebrate the &lt;strong&gt;shy-phen&lt;/strong&gt;? It has everything to do with its entity name and its function. The name is &lt;code&gt;&amp;amp;shy;&lt;/code&gt; and its function is to only show itself once really needed and else it hides. So in other words, its a very shy tag!!!. &lt;/p&gt;

&lt;p&gt;When we consider its function, its terrible to use. You need to put in words to break them up on locations you want to allow it to be broken up. So far so good. &lt;br&gt;
However you don't want to add this hidden hyphenation in every word, because it would make the text hard to read so ideally you only implement on words you know to be to long to render in a single line, so that they break up nicely on smaller screens. With the advents of folding phones and phones and screens having different pixel densities it is quite up in the air if your shy hyphen will ever come out to play. &lt;/p&gt;

&lt;p&gt;Anywho, here is my love post about a very shy hyphen. Let me know if you have any unicode or html entity you feel strongly about :D. &lt;/p&gt;

</description>
      <category>html</category>
      <category>frontend</category>
      <category>unicode</category>
    </item>
  </channel>
</rss>
