darul75 / angular-awesome-slider

:arrows_clockwise: Angular slider control directive
http://darul75.github.io/angular-awesome-slider/
MIT License
144 stars 63 forks source link

Using ng-slider in tests #54

Closed primez closed 9 years ago

primez commented 9 years ago

Hello, Julien! Sorry to disturb you again, but I've encountered another problem with ng-slider. I am trying to test my application with karma and jasmine in phantomjs browser. When running my tests I get different errors from ng-slider.js file. Firstly, I had an issue with jQuery (an error message: ReferenceError: Can't find variable: jQuery) -> I have solved it by adding jQuery as a loaded module into browser (karma configuration section for files). Next I had to add micro-templating to solve a problem with undefined tmpl variable. And now I'm stuck with an error - ReferenceError: Can't find variable: Draggable.

And one weird thing I can't understand is how it works without these dependencies in my app

Could you, please, tell me where I can find this library to include it to the list, because I can't find it anywhere.

Thank you in advance!

darul75 commented 9 years ago

Hi Leonov, Thanks for sharing and do not hesitate, I will always check what is going on. I need also to implement tests with karma but did not get time for this until now. Weird there is still a jquery dependency, if you got a scenario or sources test directory to send me. Draggable is just an inner class object used by slider and already included. Maybe minification has some issues... In src directory you will find a .html to serve some ui testings and will see jquery is not included for instance. Next step for me is to implement tests and and see if same problems occured as you have described ;) For template I need to check this part. With your tests are you including the minified version ng-slider.min.js ?

Envoyé a coup de ipons

Le 16 janv. 2015 à 22:24, Vladyslav Leonov notifications@github.com a écrit :

Hello, Julien! Sorry to disturb you again, but I've encountered another problem with ng-slider. I am trying to test my application with karma and jasmine in phantomjs browser. When running my tests I get different errors from ng-slider.js file. Firstly, I had an issue with jQuery (an error message: ReferenceError: Can't find variable: jQuery) -> I have solved it by adding jQuery as a loaded module into browser (karma configuration section for files). Next I had to add micro-templating to solve a problem with undefined tmpl variable. And now I'm stuck with an error - ReferenceError: Can't find variable: Draggable.

Could you, please, tell me where I can find this library to include it to the list, because I can't find it anywhere.

Thank you in advance!

— Reply to this email directly or view it on GitHub.

primez commented 9 years ago

Thanks for reply!

With your tests are you including the minified version ng-slider.min.js ?

Yes, I've included a minified version of ng-slider.

Weird there is still a jquery dependency, if you got a scenario or sources test directory to send me.

I would like to send you my sources, but, unfortunately, I can't, because the app is not mine.

It seems that I will have to wait till you implement your tests with karma to know if there is something wrong.

I am just curious what does "Envoyé a coup de ipons" mean? Google Translator translates it into something completely meaningless.)

Maybe my karma.conf.js can tell something:

'use strict';

module.exports = function(config) {

  config.set({

    basePath: '',

    autoWatch : false,

    frameworks: ['jasmine'],

    browsers : ['PhantomJS'],

    files: [
      'bower_components/angular/angular.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'bower_components/angular-cache/dist/angular-cache.js',
      'bower_components/angular-animate/angular-animate.js',
      'bower_components/lodash/dist/lodash.js',
      'bower_components/jquery/dist/jquery.js',
      'test/helpers/micro-templating.js',
      'bower_components/ng-slider/dist/ng-slider.min.js',
      'src/**/*.js',
      'test/**/*.mocha.js'],

    exclude: [],

    logLevel: config.LOG_INFO,

    captureTimeout: 20000,

    plugins : [
        'karma-phantomjs-launcher',
        'karma-jasmine'
    ]
  });
};

When I run karma I get this message: http://take.ms/aIr8H My test file: https://gist.github.com/primez/578d759452755a8eba5e#file-gistfile1-js My app.js file: https://gist.github.com/primez/b2685d49f471954e10a2#file-gistfile1-js

darul75 commented 9 years ago

ok, I see, do not include jquery.slider.js but this one https://raw.githubusercontent.com/darul75/ng-slider/master/dist/ng-slider.min.js named ng-slider.min.js. jquery.slider.js is just original jquery lib, not the angular one. I have also added some unit tests if interested : https://github.com/darul75/ng-slider/blob/master/test/prettySpec.js

primez commented 9 years ago

It is great that you have added tests so fast. Thank you!

darul75 commented 9 years ago

at your service glad it helps you