Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Add support for loading style fixtures #87

Closed
wants to merge 7 commits into from
Closed

Add support for loading style fixtures #87

wants to merge 7 commits into from

Conversation

angryobject
Copy link
Contributor

Hi! I was writing tests for a jQuery plugin recently and some of the tests relied on css. I need a position: absolute rule to be applied to some div's in order to test left and right properties.

I didn't want to add styles directly to the SpecRunner.html itself and wanted to kind of tie them up to the fixtures i was testing. I tried to add the style tag wight an @import rule directly to the fixture html file, but that worked half of the time. Sometimes tests passed, sometimes not and i got a NaN while trying to test left or right properties against a real number. I think that was because css rules sometimes didn't apply just in time.

So, i managed to write an addon to be able to load style fixtures directly in tests and it seems to solve my problem. I added preload, load and set methods for style fixtures. Please, check if you could incorporate this into you library, may be it would be useful for someone else.

@travisjeffery
Copy link
Collaborator

Can you update the tests, documentation, and additionally show me a usage example of this.

@angryobject
Copy link
Contributor Author

Ok, i'll do my best ASAP. I used it here https://github.com/MaxShishkin/ho-ho-acc/blob/master/tests/spec/HoHoAccSpec.js. Lines 12, 13 and 19 in particular. This are tests for a jquery plugin i wrote about earlier.

@angryobject
Copy link
Contributor Author

I've made some changes. Added tests and updated the Readme file.

Tests are added only for methods that are implemented in this module itself. Those methods that are borrowed from Fixtures (like read, makeFixtureUrl_ and others) via prototype i don't test assuming that they are well tested before.

P.S. I probably should've made this pull request on a separate branch for convenience, but that's my first pull request, i was mistaken.

travisjeffery pushed a commit that referenced this pull request Aug 27, 2012
* style-fixtures:
  Allow loading style fixtures (fix #87)
@travisjeffery
Copy link
Collaborator

Yeah, no problem. At this point I have a good workflow for doing stuff like this efficiently. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants