mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-01 19:54:45 +00:00
removing anchor spec and improving jqLite.trigger() method
- removing the last anchor spec because it can't run reliably in all browsers - improving jqLite.trigger() method
This commit is contained in:
parent
8e40e7070d
commit
a930e782a5
2 changed files with 4 additions and 26 deletions
|
|
@ -119,9 +119,10 @@ JQLite.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger: function(type) {
|
trigger: function(type) {
|
||||||
var evnt = document.createEvent('MouseEvent');
|
var evnt = document.createEvent('MouseEvents'),
|
||||||
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, _null);
|
element = this[0];
|
||||||
this[0].dispatchEvent(evnt);
|
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
|
||||||
|
element.dispatchEvent(evnt);
|
||||||
},
|
},
|
||||||
|
|
||||||
replaceWith: function(replaceNode) {
|
replaceWith: function(replaceNode) {
|
||||||
|
|
|
||||||
|
|
@ -500,20 +500,6 @@ describe("widget", function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('a', function() {
|
describe('a', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
//TODO (igor): lame workaround for
|
|
||||||
//http://code.google.com/p/js-test-driver/issues/detail?id=144
|
|
||||||
document.location.hash = '';
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
afterEach(function() {
|
|
||||||
//TODO (igor): see beforeEach
|
|
||||||
document.location.hash = '';
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('should prevent default action to be executed when href is empty', function() {
|
it('should prevent default action to be executed when href is empty', function() {
|
||||||
var orgLocation = document.location.href,
|
var orgLocation = document.location.href,
|
||||||
preventDefaultCalled = false,
|
preventDefaultCalled = false,
|
||||||
|
|
@ -546,15 +532,6 @@ describe("widget", function(){
|
||||||
|
|
||||||
expect(document.location.href).toEqual(orgLocation);
|
expect(document.location.href).toEqual(orgLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should change location when href is nonempty', function() {
|
|
||||||
var orgLocation = document.location.href;
|
|
||||||
|
|
||||||
compile('<a href="#newLocation">goto</a>');
|
|
||||||
click(element);
|
|
||||||
expect(document.location.href).toEqual(orgLocation + 'newLocation');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue