GithubHelp home page GithubHelp logo

iqualify / karma-jasmine-jquery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bessdsv/karma-jasmine-jquery

0.0 0.0 0.0 87 KB

Jasmine-jquery plugin for Jasmine in Karma

License: Other

JavaScript 100.00%

karma-jasmine-jquery's Introduction

karma-jasmine-jquery

Jasmine-jquery plugin for Jasmine in Karma.

It karma adapter for

Installation

Install the plugin from npm:

$ npm install karma-jasmine-jquery

Attention

karma-jasmine-jquery has a dependency on jasmine, so you should use karma-jasmine as well before karma-jasmine-jquery. Please note the followings.

This plugin will only work for version karma-jasmine 2.0 and above.

Usage

karma will autoload all plugins, whose name start with karma-, you can import karma-jasmine-jquery plugins manually. Please refer to http://karma-runner.github.io/0.12/config/plugins.htmt for more details.

// karma.conf.js
module.exports = function(config) {
  config.set({

      frameworks: ['jasmine-jquery','jasmine']
      //...
   })
}

The order('jasmine-jquery','jasmine') is important since it affects the order in which the files will be included to karma. Right order - reverse as karma works on the principle of LIFO stack.

Information

This plugin already includes jquery version 2.1.1, it is used for the plugin. However, in the project, you can use a version of jquery (it can be both below and above) and they will not interfere with each other. When writing tests using jquery $ for the project, and to use jquery 2.1.1, use a global variable $j (it makes sense when you want to use when writing test jquery 2 opportunities that are not available in the current version of jquery used in your project, as I). Example of use:

// karma.conf.js
module.exports = function(config) {
  config.set({

      frameworks: ['jquery-1.3.2', 'jasmine-jquery', 'jasmine'],
      //...
   })
}

// Jasmine test example

it('test1', function() {
    $().destroyWin('window'); // jquery 1.3.2
    expect($j('#window')).not.toBeInDOM(); // $j = jquery 2.1.1
  });

karma-jasmine-jquery's People

Contributors

bessdsv avatar subjunk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.