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

Include css files in browser #431

Closed
alindsay55661 opened this issue Mar 27, 2013 · 16 comments · Fixed by #601
Closed

Include css files in browser #431

alindsay55661 opened this issue Mar 27, 2013 · 16 comments · Fixed by #601

Comments

@alindsay55661
Copy link

Some of my tests require css libraries to be included such as Bootstrap. Currently I don't see a way of doing this. It would be nice if Karma would allow for specifying css files in a fashion similar to javascript files.

@vojtajina
Copy link
Contributor

Yep, let's extend the web server to properly serve css files. (Instead of <script> tag, insert a <link ....> and set correct mime type.

@revolunet
Copy link

Yes we need to be able to include CSS files as it useful for the tests : transition events, sizing, jQuery selectors...

@matsko
Copy link
Contributor

matsko commented Jun 13, 2013

Hey @vojtajina, I'm up for making a PR for this. AngularJS needs it for including the angular.css inside of the tests. Does that work for you?

@vojtajina
Copy link
Contributor

@matsko absolutely!

@matsko
Copy link
Contributor

matsko commented Jun 15, 2013

@vojtajina this is what you had in mind when we spoke earlier right?

@vojtajina
Copy link
Contributor

Yep

On Fri, Jun 14, 2013 at 5:05 PM, Matias Niemelä notifications@github.comwrote:

@vojtajina https://github.com/vojtajina this is what you had in mind
when we spoke earlier right?


Reply to this email directly or view it on GitHubhttps://github.com//issues/431#issuecomment-19487848
.

@timols
Copy link
Contributor

timols commented Jun 26, 2013

👍 am running into the same issue here too. Would be happy to collaborate on a PR too.

timols added a commit to timols/karma that referenced this issue Jul 2, 2013
@revolunet
Copy link

thanks @timols !

@timols
Copy link
Contributor

timols commented Jul 9, 2013

Hi @vojtajina do you have this slated for release 0.9.5?

@vojtajina
Copy link
Contributor

@timols yep, but let's fix the #636 first

@romankuzmik
Copy link

is it in latest 0.10 release yet? I do not see anything in docs related to how to use it. Thanx!

@romankuzmik
Copy link

nevermind, looked at sources,

// list of files / patterns to load in the browser
files: [
  'node_modules/chai/chai.js',
  'node_modules/sinon/pkg/sinon.js',
  'lib/ext.dev/ext-all-dev.js',
  'lib/ext/resources/ext-theme-neptune/ext-theme-neptune-all.css',

works just fine.

@PVince81
Copy link

Is this broken again in karma 0.12.16 ?

I tried including a CSS file using this:

config.set({
...
    files: [
        'js/*.js',
        'css/*.css'
    ],
...
});

Then going to debug.html I inspected the "head" tag of the page but there is no "link" tag appearing.
Adding the explicit CSS file name instead of a wildcard also didn't work.

I couldn't find any useful information related to this feature after googling.
Am I doing it wrong ?

@PVince81
Copy link

Hmmm... I was looking in the wrong place. They seem to be included in the "body" tag instead.
Also it seems I need to add a proxies section to serve them.
Would be good to have this documented better.

Thanks.

@Nate-Wilkins
Copy link

@PVince81 proxies section? I'm in the same boat - unable to load css.

Edit: Lied I can but I didn't have to include a proxies section. Wasn't using the included property. proxies seems unrelated?

@bupy7
Copy link

bupy7 commented Apr 29, 2017

Don't work in my case. Version of Karma: 1.6.0. Additional I'm using grunt-karma package. I added path to a css file, but it don't work.

Config: https://github.com/bupy7/js-cropbox/blob/master/Gruntfile.js#L41
My solution of the problem: https://github.com/bupy7/js-cropbox/blob/master/tests/fixtures/body.html#L2

What do I do wrong? May be grunt-karma have a bug?

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.

9 participants