Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karma-jasmine-html-reporter spec links not working #1775

Closed
mcm-ham opened this issue Jan 6, 2020 · 6 comments · Fixed by #1807
Closed

karma-jasmine-html-reporter spec links not working #1775

mcm-ham opened this issue Jan 6, 2020 · 6 comments · Fixed by #1807

Comments

@mcm-ham
Copy link

mcm-ham commented Jan 6, 2020

Coming from: dfederm/karma-jasmine-html-reporter#26

Expected Behavior

Click "Spec List" shows list.

Current Behavior

Clicking "Spec List" reloads page and runs all tests again.

Possible Solution

Update https://github.com/jasmine/jasmine/blob/7263a38c3fb04d7fb27c468cdec8ec3eb53e0766/src/html/HtmlReporter.js

With this fix:
Chmiel123/karma-jasmine-html-reporter@20acf93

Suite that reproduces the behavior (for bugs)

  1. npm install @angular/cli
  2. ng new app
  3. Change one test in app.component.spec.ts to fail
  4. ng test
  5. (wait for tests to compile/run) Should see "3 specs, 1 failure..."
  6. Click "Spec List".

Your Environment

  • Angular: 8.2.14
  • Jasmine-Core: 3.4.0
  • karma-jasmine-html-reporter: 1.4.2
@slackersoft
Copy link
Member

I don't think we want to remove the actual href from the links, since that is one of the things that tell browser that the a tag is supposed to be interactable. At a minimum this loses the default cursor change and other similar accessibility features.

Normally a link to an anchor (e.g. #) shouldn't actually do a navigate either. It doesn't seem to in Jasmine without Karma at least, or we would have heard about this before. If we can't figure out what might be happening with Karma, I would be happy to review a pull request to do something like preventDefault in the click handler for those menu links so they don't cause Karma to reload the page.

Hope this helps. Thanks for using Jasmine!

@abeninskibede
Copy link

same here

@abeninskibede
Copy link

Is there a workaround for this?

@Miguelcldn
Copy link

@abeninskibede I managed to work around it by clicking the DEBUG button on the top bar. You'll have another tab where there won't be '#' refs, so clicks won't reload. I don't know the exact difference about debug mode though, but it works for me.

@parloti parloti mentioned this issue Apr 3, 2020
8 tasks
@abeninskibede
Copy link

Hey,
How can I install that?

@parloti
Copy link
Contributor

parloti commented Apr 21, 2020

@abeninskibede

Hey,
How can I install that?

See: stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants