<?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: Sergey Blohin</title>
    <description>The latest articles on Forem by Sergey Blohin (@tit).</description>
    <link>https://forem.com/tit</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%2F283482%2F00120e0d-62f0-4a80-8b08-21f1e1161492.jpeg</url>
      <title>Forem: Sergey Blohin</title>
      <link>https://forem.com/tit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tit"/>
    <language>en</language>
    <item>
      <title>Writing Comments in "multiline" commands in Bash Scripts</title>
      <dc:creator>Sergey Blohin</dc:creator>
      <pubDate>Sat, 22 May 2021 21:54:29 +0000</pubDate>
      <link>https://forem.com/tit/writing-comments-in-multiline-commands-in-bash-scripts-5cnb</link>
      <guid>https://forem.com/tit/writing-comments-in-multiline-commands-in-bash-scripts-5cnb</guid>
      <description>&lt;p&gt;For example, you have the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://example.com \
     --request "POST" \
     --data "foo=42"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to comment on the request argument.&lt;br&gt;
Use next solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://example.com \
     `# request is HTTP method`
     --request "POST" \
     --data "foo=42"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>bash</category>
      <category>tricks</category>
    </item>
    <item>
      <title>.innerText vs. .textContent in Cypress</title>
      <dc:creator>Sergey Blohin</dc:creator>
      <pubDate>Tue, 30 Mar 2021 19:56:36 +0000</pubDate>
      <link>https://forem.com/tit/innertext-vs-textcontent-in-cypress-53jh</link>
      <guid>https://forem.com/tit/innertext-vs-textcontent-in-cypress-53jh</guid>
      <description>&lt;p&gt;When we use the &lt;code&gt;have.text&lt;/code&gt; assertion, we expect the validation to be full-text, by &lt;code&gt;.innerText&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

cy
  .get('div')
  .should('have.text', 'foo');


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;But Cypress &lt;code&gt;have.text&lt;/code&gt; returns &lt;code&gt;.textContent&lt;/code&gt;.&lt;br&gt;
This behaviour can cause unexpected results.&lt;br&gt;
For example, your HTML code may have the following code:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;div&amp;gt;foo&amp;lt;span style="display: none;"&amp;gt;bar&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The browser will only show &lt;code&gt;foo&lt;/code&gt;.&lt;br&gt;
Also, &lt;code&gt;document.querySelector('div').innerText&lt;/code&gt; will only show &lt;code&gt;foo&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;gt; $0
&amp;lt; &amp;lt;h1&amp;gt;​"foo"&amp;lt;span style=​"display:​ none;​"&amp;gt;​bar​&amp;lt;/span&amp;gt;​&amp;lt;/h1&amp;gt;​
&amp;gt; $0.innerText
&amp;lt; "foo"
&amp;gt; $0.textContent
&amp;lt; "foobar"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ljgjbu5qhpqas9kvzmm.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ljgjbu5qhpqas9kvzmm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Cypress&lt;/code&gt; use &lt;code&gt;MochaJS&lt;/code&gt; =&amp;gt; &lt;code&gt;Chai&lt;/code&gt; =&amp;gt; &lt;code&gt;Chai-jQuery&lt;/code&gt; =&amp;gt; &lt;code&gt;jQuery&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/core.js#L276" rel="noopener noreferrer"&gt;github.com/jquery/jquery/src/core.js#L276&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

// Retrieve the text value of an array of DOM nodes
    text: function( elem ) {
        var node,
            ret = "",
            i = 0,
            nodeType = elem.nodeType;

        if ( !nodeType ) {

            // If no nodeType, this is expected to be an array
            while ( ( node = elem[ i++ ] ) ) {

                // Do not traverse comment nodes
                ret += jQuery.text( node );
            }
        } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
            return elem.textContent;
        } else if ( nodeType === 3 || nodeType === 4 ) {
            return elem.nodeValue;
        }

        // Do not include comment or processing instruction nodes

        return ret;
    },


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>cypress</category>
      <category>mochajs</category>
      <category>chai</category>
      <category>jquery</category>
    </item>
  </channel>
</rss>
