<?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: Arya</title>
    <description>The latest articles on Forem by Arya (@ariya_vijaykumar).</description>
    <link>https://forem.com/ariya_vijaykumar</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%2F1626783%2F26385d04-8b49-405c-85fc-7aeeaf7d735c.jpg</url>
      <title>Forem: Arya</title>
      <link>https://forem.com/ariya_vijaykumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ariya_vijaykumar"/>
    <language>en</language>
    <item>
      <title>Browser refresh on click of Home button using href</title>
      <dc:creator>Arya</dc:creator>
      <pubDate>Tue, 02 Jul 2024 11:57:04 +0000</pubDate>
      <link>https://forem.com/ariya_vijaykumar/browser-refresh-on-click-of-home-button-using-href-2iko</link>
      <guid>https://forem.com/ariya_vijaykumar/browser-refresh-on-click-of-home-button-using-href-2iko</guid>
      <description>&lt;p&gt;I have a question on writing angular testcases on browser refresh.&lt;br&gt;
Angular is a single page application .there is no browser refresh after logging in. I am building a website with angular in the frontend but not entirely. You will see what i mean in the below example scenario&lt;/p&gt;

&lt;p&gt;When I am in Contacts page of the application ,and I click on the logo ,it should navigate me to the homepage always.&lt;br&gt;
I could have simply gone with router link, but there is a catch.&lt;br&gt;
See when Iam in contacts page of the application, the contacts tab is selected in the left-nav-item. When i click on the logo to navigate to the home button, the selection should not be there anymore. means it should work like a browser refresh. For that ,Iam using href instead of router link&lt;/p&gt;


&lt;br&gt;
    &lt;span&gt;&lt;a href="home-page"&gt;Logo&lt;/a&gt;&lt;/span&gt;&lt;br&gt;
 

&lt;p&gt;This will reload the page. See, what i mean when i said not fully angular .&lt;/p&gt;

&lt;p&gt;Now my issue is with the testcases.I cant write element.click()&lt;/p&gt;

&lt;p&gt;it("should navigate to home page on click of logo",() =&amp;gt; {&lt;br&gt;
    const element = fixture.nativeElement.querySelector(".appName a") as HTMLElement;&lt;br&gt;&lt;br&gt;
    spyOn(window.location, 'reload'); &lt;br&gt;
    element.click();&lt;br&gt;
    expect(window.location.reload).toHaveBeenCalled();&lt;br&gt;
  });&lt;/p&gt;

&lt;p&gt;here element.click() will reload the page and so the test cases also stop to return Not Found.&lt;/p&gt;

&lt;p&gt;I need to trigger the click() here to check if the browser is refreshed.Any suggestion on how to achieve it?&lt;/p&gt;

</description>
      <category>fullstack</category>
      <category>angular</category>
      <category>angulartestcases</category>
      <category>routing</category>
    </item>
  </channel>
</rss>
