This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _ = require('lodash'); | |
/** | |
* Custom matchers for protractor and jasmine 2 | |
* | |
* expect(el).toBePresent(); | |
* expect(el).toBeDisplayed(); | |
* expect(el).toContainText('text to contain'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@bind, apply, call in javascript | |
//@description | |
//@Question: If you want to use an arbitrary object as value of this, how will you do that? | |
/*********** | |
Answer: There are at least three different ways to doing this by using bind, call and apply. | |
For example, I have a method named deductMontlyFee in the object monika | |
and by default value of this would be monika inside the method. | |
************/ | |
/*********** | |
If I bind the deductMontlyFee of monika with another object vikas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anglar.module('myApp',['ui']).config(["$provide", function($provide) { | |
return $provide.decorator("$http", ["$delegate", function($delegate) { | |
var get = $delegate.get; | |
$delegate.get = function(url, config) { | |
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html" | |
if (!~url.indexOf('template/')) { | |
// Append ?v=[cacheBustVersion] to url | |
url += (url.indexOf("?") === -1 ? "?" : "&"); | |
url += "v=" + cacheBustVersion; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function objectToQuerystring (obj) { | |
return Object.keys.reduce(function (str, key, i) { | |
var delimiter, val; | |
delimiter = (i === 0) ? '?' : '&'; | |
key = encodeURIComponent(key); | |
val = encodeURIComponent(obj[key]); | |
return [str, delimiter, key, '=', val].join(''); | |
}, ''); | |
} |