background preloader

WebDev

Facebook Twitter

Protractor - end to end testing for AngularJS. Full-Spectrum Testing with AngularJS and Karma. Learn how to fully test your AngularJS application with Karma One of the major areas of AngularJS development which needs to be covered in better detail is how to test your application.

Full-Spectrum Testing with AngularJS and Karma

But wait, how do you do that? How do you setup your test environment? How should you organize your code? How do you setup a runner and how to automate the process? It doesn't take much time to realize that testing JavaScript is difficult and finicky. This page was first published on January 21st 2013 and was last updated on November 20th 2013. The major challenge when it comes to testing JavaScript is that it requires you to have a runner setup to test your code. Karma is an amazing testing tool which is designed to take all the frustration out of setting up a working test runner when testing JavaScript code. So before we get started with Karma, lets figure out how testing works with AngularJS... So that covers two of the major testing approaches, but what about the third? What's our testing goal? Karma - Spectacular Test Runner for Javascript. JavaScript Promises: There and back again.

Mesdames et messieurs, préparez-vous pour un tournant historique dans l’histoire du développement web… [Roulement de tambour] Les promesses sont enfin arrivées en natif dans JavaScript !

JavaScript Promises: There and back again

[Explosion de feux d’artifice, des confettis pailletés pleuvent, la foule est en délire] À ce moment-là, vous appartenez à l’une des catégories suivantes : Les gens autour de vous débordent de joie, mais vous ne savez pas vraiment ce qu’on est en train de célébrer. Pourquoi toute cette excitation ? JavaScript s’exécute avec un thread unique, ce qui signifie que deux morceaux de script ne peuvent pas s’exécuter en même temps, ils doivent être exécutés l’un après l’autre. En tant qu’être humain, vous êtes multi-thread.

Vous avez probablement eu recours aux événements et fonctions de rappel (callback) pour contourner ce problème. Var img1 = document.querySelector('.img-1'); img1.addEventListener('load', function() { // ouais génial, image chargée !}) Ça ne donne pas du tout envie d’éternuer. Rejetée (rejected) Optimizely Blog. Jasmine: Behavior-Driven JavaScript. Selenium - Web Browser Automation. Splinter. Plone CMS: Open Source Content Management. Improving performance on twitter.com. To connect you to information in real time, it’s important for Twitter to be fast.

Improving performance on twitter.com

That’s why we’ve been reviewing our entire technology stack to optimize for speed. When we shipped #NewTwitter in September 2010, we built it around a web application architecture that pushed all of the UI rendering and logic to JavaScript running on our users’ browsers and consumed the Twitter REST API directly, in a similar way to our mobile clients. That architecture broke new ground by offering a number of advantages over a more traditional approach, but it lacked support for various optimizations available only on the server. To improve the twitter.com experience for everyone, we’ve been working to take back control of our front-end performance by moving the rendering to the server.

This has allowed us to drop our initial page load times to 1/5th of what they were previously and reduce differences in performance across browsers. No more #! Reducing time to first tweet Loading only what we need. Pylons Project : Home. Prerender - AngularJS SEO, BackboneJS SEO, or EmberJS SEO. Server vs client side rendering (AngularJS vs server side MVC) There’s a lot of discussion related to server vs client side application rendering.

Server vs client side rendering (AngularJS vs server side MVC)

While there is no “one choice fits all” solution, I’ll try to argue in favor of client side (specifically AngularJS) from different points of view. First of them is architecture. Well done architecture has clearly defined separation of concerns (SoS). In most cases minimal high level configuration is: Data storageServicesAPIPresentation Each of those layers should have only minimal knowledge of the one above. A lot more should be said for each of those layers and the situation in the “real world” is much more complicated than this. Taking developers skills into account is an important aspect of the architecture. No matter the existing knowledge, there are some skills required by the type of the application.

Server side is easier to cope with. Similar can be said for development of mobile devices. Since we established that, in case of Web sites (who said applications?) Leaflet - a JavaScript library for mobile-friendly maps.

Go