Category: javascript

Single beforeEach() in Jasmine 0

Single beforeEach() in Jasmine

  << @philipraath @olignyf a beforeAll or beforeEach that is not inside of any describe will be applied to all suites/specs, as appropriate, during the execution of the suite. >> https://github.com/jasmine/jasmine/issues/811

Upgrade Jasmine 1.3 to 2.4 0

Upgrade Jasmine 1.3 to 2.4

Quick upgrade with those Regexp replaces /createSpyObj/ => " jasmine.createSpyObj" /createSpy/ => "jasmine.createSpy" /\.andCallFake/ => ".and.callFake" /\.andReturn/ => ".and.returnValue" /\.andCallThrough/ => ".and.callThrough" /toNotMatch/ => "not.toMatch" /this.addMatchers/ => "jasmine.addMatchers" /\.calls\[0\]\./ => ".calls.first()" /\.calls\[(\d)\]\./ => ".calls.all()[$1]"...

String manipulations in Javascripts 0

String manipulations in Javascripts

String.indexOf() Return value: -1 if not found 0 or higher than 0 as the index of the position found Remove one part of a string Method 1: String.replace(//, ""); Method 2: var indexEnd =...

Submit a form with ajax 0

Submit a form with ajax

This is a basic operation that you might have to do when upgrading an old web app. One solution is using jQuery .serialize() function   Method #1: Sent using CGI params key=value pairs: var...

Javascript hostname and ip validate 0

Javascript hostname and ip validate

Validating hostname and IP occurs pretty often. This is what I use for a field that can contain both IPV4 or hostname : if (value.length === 0 || value.length > 511) { return "Address...

Supporting IE 8 0

Supporting IE 8

Why would anyone care about IE8 ? Well sometime we have to if our clients is still on it, and yes in 2015, there are groups in the federal business that still only use...

Create your own Chrome Extension 0

Create your own Chrome Extension

How to test your extension during development 1. Navigate to chrome://extensions 2. Click on "Load unpacked extension..." Troubleshooting Problem There were warnings when trying to install this extension: Permission '://.google.com' is unknown or URL...