Output jasmine test results to the console

Have you tried the ConsoleReporter? jasmine.getEnv().addReporter(new jasmine.ConsoleReporter(console.log)); According to the code Jasmine has the ConsoleReporter class that executes a print function (in this case console.log) that should do what you need. If all else fails you could just use this as a starting point to implement your own console.log reporter. UPDATE In newer versions of … Read more

How to generate UL Li list from string array using jquery?

var countries = [‘United States’, ‘Canada’, ‘Argentina’, ‘Armenia’]; var cList = $(‘ul.mylist’) $.each(countries, function(i) { var li = $(‘<li/>’) .addClass(‘ui-menu-item’) .attr(‘role’, ‘menuitem’) .appendTo(cList); var aaa = $(‘<a/>’) .addClass(‘ui-all’) .text(countries[i]) .appendTo(li); });

How to set up JavaScript namespace and classes properly?

Do neither of those things. Make a javascript “class”: var MyClass = function () { var privateVar; //private var privateFn = function(){}; //private this.someProperty = 5; //public this.anotherProperty = false; //public this.someFunction = function () { //public //do something }; }; MyNamespace.MyClass = new MyClass(); One with static vars: var MyClass = (function(){ var static_var; … Read more

Accessibility and all these JavaScript frameworks

I use a js-framework (spine.js in my case) in my latest site. Still I make sure that non-js browsers (certainly not over zealous: think SEO) can navigate my site and digest the contents. As an example I’m going with a search-page with products being shown. Products can be paged, filtered, sorted. Of course this is … Read more