tag : JavaScript

Unit Testing Socket.IO With Jasmine

Recently I finished up talking about how to use Jasmine as your JavaScript Unit Testing framework (part 1 and part 2). In there I mentioned how to test asynchronous methods, but I decided to write up a more useful example while giving you a sneak peak of the current state of a component from my Minecraft Server Manager project. Here you’ll see how I handled Socket.IO both for the application and for testing.

Using jQuery to Delay SharePoint Navigation Hover

SharePoint is a separate kind of beast. You would think you could easily go make adjustments but it’s not always the case. The problem is when you come to the point where you need to do a SharePoint migration and need to rewrite all your code. However, that is a whole other story. In this article the problem I want to solve is the annoying drop down menu in SharePoint Publishing sites that shows up way too quickly and therefore annoys our End Users who accidently hover over it.

JavaScript Unit Testing With Jasmine: Part 2

Last week, we started strolling through Jasmine and seeing what it had to offer us with regards to unit testing. Today, we’ll be finishing that up with some of the more advanced features included with Jasmine so that you can see the whole package and get started unit testing your own JavaScript. Trust me, even its advanced features are simple to use, so there shouldn’t be anything holding you back from reading this and getting started doing your own unit testing.

JavaScript Unit Testing With Jasmine: Part 1

Now that you have an awesome testing environment with Testem set up, you need to actually start writing tests. This is where people begin to feel daunted. “Oh no, I need to learn another library” comes to many people’s minds and because this library doesn’t add any cool features to your site or application, it doesn’t seem like much fun. We need to brush that aside, though, because testing libraries tend to have very, very simple APIs and can be learned within a couple hours of tinkering. Let me prove it to you.

Setting Up a Jasmine Unit Testing Environment With Testem

Everyone knows now that unit testing is good and that they should do it, but it’s not exactly simple to get started, but once you’re going, it’s pretty simple and highly valuable. But how do you get started? I’ll show you a great setup for Jasmine to get you up and running with unit testing and doing it with style with Testem. Testem and Jasmine come together to make unit testing fun and simple.

Tips for Front End Unit Testing

Building complex programs is just a matter of breaking it down into smaller units, and then putting them together. Unit testing is the testing of those smaller units. If you haven’t written unit tests for your code yet, you should. It’s worth the effort. It helps you think through the expectations of your code in an organized way, minimizes risk and effort when changing that code, and encourages modular design — which has its own benefits.

JavaScript Auto-Completion for Notepad++

Good code editors generally all share some common features such as syntax highlighting, tabs for editing multiple files, automatic tabbing to keep the same indentation level, and of course auto-completion. Notepad++ is a well known code editor that’s lightweight and extendable. Many people don’t realize, though, how to turn on auto-completion for this editor and ask me how I do it.

Dependency Injection With Node.js

Recently, I went over Dependency Injection to help you understand a simple way to decouple your code a little bit and help your testing out. Sometimes, though, in Node.js a module will depend on a system API provided by Node, which can make it pretty difficult to make sure that private dependency is being used properly. Normal dependency injection doesn’t work in this situation, but don’t give up hope just yet.

Event-Based Architecture: Getting Decoupled

Every JavaScript developer knows that events are quite normal in JavaScript and that an event-based system can be quite fun and simple to use. Most even use event mechanisms almost every time they write JavaScript, but have you tried taking it to the extreme? What does it look like when you have an application architecture that rarely has two objects communicating directly with one another?

Dependency Injection With JavaScript

When looking through design patterns that help to decouple objects in your applications, one of the simplest techniques to use is dependency injection. This is a common practice in Backbone.js, most notably when assigning models to views, but I haven’t seen it as much as I think I should. Here I’ll be examining what dependency injection is, how it helps, and how I’m putting it to good use in my latest project.