Skip to content

Instantly share code, notes, and snippets.

View geraldofcneto's full-sized avatar

Geraldo Castro geraldofcneto

View GitHub Profile
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)){
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();
})()