-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
using common CSS class names on Jasmine DOM elements can cause unintended behavior #844
Comments
👍 to prepending I'd encourage you to give it a good try. If any of the maintainers disagree with any of your choices they can comment on the Pull Request and give feedback, although everything you're saying sounds quite reasonable. |
Thanks for the counsel. I was definitely thinking of proceeding to that next step. Told myself I'd wait a week. I have a lot of student work, but the chance to make an accepted commit to a real-world project like Jasmine is probably well worth the time. It does make sense to craft a solution and request pull, because then they can review it and tell me what they really want to see, and then I can do that, and then bam it's done. Thanks again. edit/update: second update: |
Okay I made a Pull Request: Here is the general context and the general thinking I used to implement a fix:
I don't care much if my particular implementation of a fix for this Issue is used. Perhaps someone will judge that there is a better method to get to the same endpoint. I just wrote a fix to get the conversation started. There's got to be more work to do before it's really fixed, right? I've written an explanation here... ...for why I couldn't test my code with |
commit e7445de Merge: 99f64eb 175fe11 Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Sun Feb 19 16:26:10 2017 +0530 Merge branch 'master' of https://github.com/aishwarya-an/Feed-Reader-Tester commit 99f64eb Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Sun Feb 19 16:24:47 2017 +0530 Preparing for merging. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit 175fe11 Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 18:46:12 2017 +0530 Updated README.md commit 06125a8 Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 18:32:58 2017 +0530 Added a condition in the test of Initial Entries test suite to check for out-of-bound array access. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit 6259beb Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 18:25:13 2017 +0530 Added the tests to the New Feed Selection test suite. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit 4b10c0b Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 17:59:18 2017 +0530 Added tests to the Initial Entries test suite. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit d6be6ac Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 17:48:28 2017 +0530 Added tests to the menu test suite. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit 00a1af2 Author: Aishwarya A N <aishwarya.an95@gmail.com> Date: Tue Feb 14 17:33:57 2017 +0530 Added tests in the RSS Feed test suite. Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com> commit b6f2a90 Author: Mike Wales <michael.wales@udacity.com> Date: Fri Jul 1 11:19:16 2016 -0700 Updates CSS-Tricks feed URL commit fa3b64a Author: Susan Smith <susan.smith@udacity.com> Date: Wed Jun 22 18:26:39 2016 -0400 Update README.md commit 0df2317 Author: Heidi Kasemir <heidi.kasemir@gmail.com> Date: Fri Jan 22 12:51:42 2016 -0800 Update feedreader.js commit 55ed1f7 Merge: 91bf116 86a340b Author: Michael Wales <webmaster@michaelwales.com> Date: Fri Dec 4 12:29:40 2015 -0800 Merge pull request #9 from prather-mcs/change-CSS-to-avoid-Jasmine-bug Change CSS to avoid Jasmine bug commit 86a340b Author: Matt Prather <prather.mcs@gmail.com> Date: Fri Dec 4 11:36:11 2015 -0800 Update index.html Removed 'hidden' class from class attribute value. commit d1345e1 Merge: 8e9853d 91bf116 Author: Matt Prather <prather.mcs@gmail.com> Date: Fri Dec 4 10:41:01 2015 -0800 Change CSS to avoid Jasmine bug I use pictures to show how this bug makes the project more confusing to students here: http://discussions.udacity.com/t/found-an-actual-bug-in-jasmine/17025 I reported and fixed the Jasmine bug here: jasmine/jasmine#844 commit 91bf116 Merge: 0de23b8 829cee9 Author: Michael Wales <webmaster@michaelwales.com> Date: Thu Dec 3 15:08:23 2015 -0800 Merge pull request #8 from prather-mcs/fix-spelling Change "occuring" to "occurring" commit 0de23b8 Merge: d99cce6 819e11d Author: Michael Wales <webmaster@michaelwales.com> Date: Thu Dec 3 15:04:30 2015 -0800 Merge pull request #12 from skh/fix-udacity-feed-url Use current feed URL for Udacity Blog commit d99cce6 Author: Mike Wales <michael.wales@udacity.com> Date: Thu Dec 3 12:50:46 2015 -0800 Fixes loadFeed() to use Udacity RSStoJSON rather than deprecated Google Feed Reader API. commit 708975b Author: Susan Smith <susan.smith@udacity.com> Date: Mon Oct 5 16:41:27 2015 -0400 Update index.html Line 29. Removed 'hidden' class from class attribute value. commit 819e11d Author: Sonja Krause-Harder <skh@rcane.de> Date: Sun Sep 27 11:44:14 2015 +0200 Use current feed URL for Udacity Blog commit 8e9853d Author: Matt Prather <prather.mcs@gmail.com> Date: Sat May 16 12:38:18 2015 -0700 Change CSS to avoid Jasmine bug I use pictures to show how this bug makes the project more confusing to students here: http://discussions.udacity.com/t/found-an-actual-bug-in-jasmine/17025 I reported and fixed the Jasmine bug here: jasmine/jasmine#844 commit 829cee9 Author: Matt Prather <prather.mcs@gmail.com> Date: Sat May 16 12:07:09 2015 -0700 Change "occuring" to "occurring" I found only one spelling error. This branch and commit fixes it. http://en.wiktionary.org/wiki/occurring#English commit b218ab2 Author: Mike Wales <michael.wales@udacity.com> Date: Fri Nov 28 10:49:41 2014 -0800 Initial commit. commit 8c6662c Author: Nicolas Artman <nicolasartman@users.noreply.github.com> Date: Mon Nov 24 15:20:08 2014 -0800 Initial commit Signed-off-by: Aishwarya A N <aishwarya.an95@gmail.com>
I'm a relative new-comer in the field of front-end web dev, and there is no other comp sci / programming field in which I'm more experienced. (But hear me out anyway, ha ha.)
While working on a student project, I noticed something about Jasmine which you might consider a "bug" which causes unintended DOM interactions between Jasmine's part of the DOM and the app-that's-being-tested's part of the DOM.
And this bug does not have to exist at all; you can painlessly avoid it.
So, what is this problem?
Well, I first noticed a specific case of this bug when I saw some of Jasmine's text appearing in one of the app's divs on a student project I was working on — the words "Spec List" and "Failures" appeared on top of what should have been in my app's
.menu
div. This occurred whenever a specification failed.I have reproduced a case of this bug here:
http://codepen.io/prather-mcs/pen/bdVrdN
(this Pen is loading all necessary Jasmine assets from here)
When you un-comment the test
expect(false).toBe(true);
, then you will see the bug happen: the app's CSS for.menu
is affecting the position of Jasmine's DOM elements that also have class.menu
I'm sure you want to always keep Jasmine's information down in Jasmine's part of the document.
So that's a specific case where
.menu
is colliding.But I think the general problem you would want to fix is the creation by Jasmine of DOM elements with such commonly-used class-names as these:
.bar
.menu
.results
.summary
.banner
In summary, the Issue is this:
While none of Jasmine's CSS rules in
jasmine.css
change how the app appears, style rules in the tested app which affect any class name thatjasmine.css
also uses can cause Jasmine's DOM content to be styled in un-intended ways, including causing it to jump right out of Jasmine's part of the page and onto the app's part of the page.I would be happy to get credit for fixing this bug -- I would go to the
jasmine-html.js
code that creates DOM Nodes and ensure that all CSS class names are unique (enough) by giving them slightly new names, such as changing code that would add the class.menu
to a DOM Node to actually add the class.jasmine-menu
instead. Then I would make corresponding changes tojasmine.css
as well.However, I have not contributed to this project before, and have only been looking into the code-base for the first time this week.
I'm thinking that there are people with seniority and authority who would probably have a better idea of how to name the CSS classes than I have, and they would have a better idea of the best Jasmine app code to write to efficiently implement the fix as well.
With that being said, if you would allow me to write a fix and create a Pull request to fix this bug, I would like to get some credit contributing to open source....
The text was updated successfully, but these errors were encountered: