3

I'm getting an error when using visit in a test :

TypeError: Object # has no method 'getHandler'

module("visit", {
  setup: function() {
    Ember.run(App, App.advanceReadiness);
  },
  teardown: function() {
    App.reset();
  }
});

test("visit works", function () {
  expect(2);

  // this gets executed
  equal(1, 1);

  return visit("/").then(function() {
    // this doesn't
    equal(1, 1);
  });
});

The resulting error trace is :

Died on test #2     at eval (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:10:1)
    at eval (native)
    at eval (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:14066)
    at Function.p.extend.globalEval (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:14077)
    at p.ajaxSetup.converters.text script (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:83767)
    at cC (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:5874)
    at y (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:79888)
    at d (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:85578): Object #<Object> has no method 'getHandler'
Source:     
TypeError: Object #<Object> has no method 'getHandler'
    at generateHandlerInfos (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25824:31)
    at performTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25758:30)
    at createURLTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25501:18)
    at doTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26067:20)
    at Object.Router.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25213:20)
    at Ember.Router.Ember.Object.extend._doTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26491:53)
    at Ember.Router.Ember.Object.extend.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26331:21)
    at Ember.Application.Ember.Namespace.extend.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:30240:16)
    at Object.Backburner.run (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:4862:30)
    at Object.Ember.run (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:5200:30)

I've made sure Ember is loaded before the tests are run as suggested in this answer. QUnit is also working properly as a basic test on fixtures is working.

I've now spent hours on this issue and I don't have any clue why this is happening.

Edit (following Daniel's comment) The route is pretty simple and looks like that :

App.IndexRoute = Ember.Route.extend({
  redirect: function(){
    this.transitionTo('about');
  }
});
App.Router.map(function(){
  this.route('about');
});

Modify FireFox extension: If (scrollbar exists) var - 30 else var -14

Hello fellow code people :)

I am a frontend web developer and as such in need of constant knowledge of the actual viewport size in order to see where in responsive designing breakpoints start and end. I know FF's own 'test window size' function, but came across a very handy extension: FireSizer. the extension has one itsy bitsy drawback: It gives back the window-size including FF's borders and scrollbar. I need the viewport-size though. So I need the extension hacked, but dont't know enough javaScript to do so. Maybe someone is willing to help em out here?

I would love the extension to actually look for the scrollbar, and subtract from the width a) 14 if no scrollbar present or b) 30 if scrollbar present

I found of what I think is the right place to alter the code:

//
// Update the status bar panel with the current window size
//
function FiresizerUpdateStatus() {
    var width  = window.outerWidth  + ''; // <- Think code needs to be edited here
    var height = window.outerHeight + '';
    document.getElementById("firesizer-statuspanel").label = width + 'x' + height;
}

Thanks for any effort! AO

@Chen Asraf: Well thank you very much. I didn't know there was an element to call the document-width. I changed the code to the following, and that did the trick (also when compared to FF's own 'Responsive Design View mode', which is spot on, its off by 2px - which i subtract from clientWidth.)

function FiresizerUpdateStatus() {
var width  = window.outerWidth  + ''; // changed this line to:
var width  = document.documentElement.clientWidth-2 + '';
var height = window.outerHeight + '';
document.getElementById("firesizer-statuspanel").label = width + 'M' + height;
}

Thanks AO

4

1 に答える 1