# Cannot unit test click event & nativeElement is not updating

**URL:** <https://forum.ionicframework.com/t/cannot-unit-test-click-event-nativeelement-is-not-updating/139760>\
**Category:** Ionic Framework\
**Created:** [August 26, 2018, 1:02pm UTC](https://forum.ionicframework.com/t/cannot-unit-test-click-event-nativeelement-is-not-updating/139760 "2018-08-26T13:02:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MajedArsenal](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@MajedArsenal](https://forum.ionicframework.com/u/MajedArsenal)\
**Post date:** [August 26, 2018, 1:02pm UTC](https://forum.ionicframework.com/t/cannot-unit-test-click-event-nativeelement-is-not-updating/139760/1 "2018-08-26T13:02:13Z")

</div>

Hi, I’m writing unit tests and can’t seem to get click events working.  
When my element is visible and i click the element, nothing happens.  
I’ve also noticed fixture.nativeElement doesn’t actually change from the time it was initialized in the beforeEach method, but i guess that might be because of my original problem of not being able to click a button!

Using Ionic v4 beta, Angular 6 & Jest.

My test config:

```auto
 beforeEach(async () => {
        TestBed.configureTestingModule({
            declarations: [TestPage],
            imports: [
                IonicModule.forRoot(TestPage),
                BrowserModule,
                CommonModule,
                FormsModule,
                RouterTestingModule],
            providers: [{provide: Platform, useClass: PlatformMock},],
            schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
        }).compileComponents();
    });

```

i use this for example to click a segment button  
`this.fixture.nativeElement.querySelector('ion-segment').click()`

---

<div class="post-metadata">

**Author:** ![MajedArsenal](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@MajedArsenal](https://forum.ionicframework.com/u/MajedArsenal)\
**Post date:** [April 21, 2019, 1:01pm UTC](https://forum.ionicframework.com/t/cannot-unit-test-click-event-nativeelement-is-not-updating/139760/2 "2019-04-21T13:01:41Z")

</div>

Still an issue in the latest Ionic and Angular…

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:22pm UTC](https://forum.ionicframework.com/t/cannot-unit-test-click-event-nativeelement-is-not-updating/139760/3 "2021-07-19T21:22:37Z")

</div>


