Skip to content

Instantly share code, notes, and snippets.

Avatar

Geraldo Castro geraldofcneto

View GitHub Profile
View stateMock.js
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName, params){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState.stateName !== stateName){
throw Error('Expected transition to state: ' + expectedState.stateName + ' but transitioned to ' + stateName );
}
if(expectedState.params && !angular.equals(expectedState.params, params)){
View gist:4f96f6b9b6ab5ae8b1942c84bb7ca09f
javascript: (function(){
var savenetUrl = 'https://pt.savefrom.net/';
var div = document.createElement('div');
div.innerHTML = '<a href="'+ savenetUrl + window.location.href + '" target="_blank" id="blankLink">text</a>';
document.getElementsByTagName('body')[0].append(div);
document.getElementById('blankLink').click();
div.remove();
})()