aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/service/anchorScrollSpec.js (renamed from test/service/autoScrollSpec.js)32
-rw-r--r--test/widgetsSpec.js16
2 files changed, 19 insertions, 29 deletions
diff --git a/test/service/autoScrollSpec.js b/test/service/anchorScrollSpec.js
index 72fc3424..7e4b3aa3 100644
--- a/test/service/autoScrollSpec.js
+++ b/test/service/anchorScrollSpec.js
@@ -1,4 +1,4 @@
-describe('$autoScroll', function() {
+describe('$anchorScroll', function() {
var elmSpy;
@@ -18,9 +18,9 @@ describe('$autoScroll', function() {
}
function changeHashAndScroll(hash) {
- return function($location, $autoScroll) {
+ return function($location, $anchorScroll) {
$location.hash(hash);
- $autoScroll();
+ $anchorScroll();
};
}
@@ -46,12 +46,6 @@ describe('$autoScroll', function() {
return expectScrollingTo(NaN);
}
- function disableScroller() {
- return function($autoScrollProvider) {
- $autoScrollProvider.disable();
- };
- }
-
beforeEach(module(function($provide) {
elmSpy = {};
@@ -108,16 +102,6 @@ describe('$autoScroll', function() {
expectScrollingTo('id=top')));
- it('should not scroll when disabled', function() {
- module(disableScroller());
- inject(
- addElements('id=fake', 'a name=fake', 'input name=fake'),
- changeHashAndScroll('fake'),
- expectNoScrolling()
- );
- });
-
-
describe('watcher', function() {
function initLocation(config) {
@@ -128,13 +112,19 @@ describe('$autoScroll', function() {
}
function changeHashTo(hash) {
- return function ($location, $rootScope, $autoScroll) {
+ return function ($location, $rootScope, $anchorScroll) {
$rootScope.$apply(function() {
$location.hash(hash);
});
};
}
+ function disableAutoScrolling() {
+ return function($anchorScrollProvider) {
+ $anchorScrollProvider.disableAutoScrolling();
+ };
+ }
+
afterEach(inject(function($document) {
dealoc($document);
}));
@@ -182,7 +172,7 @@ describe('$autoScroll', function() {
it('should not scroll when disabled', function() {
module(
- disableScroller(),
+ disableAutoScrolling(),
initLocation({html5Mode: false, historyApi: false})
);
inject(
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index 753a36b4..f119174f 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -225,10 +225,10 @@ describe('widget', function() {
describe('autoscoll', function() {
var autoScrollSpy;
- function spyOnAutoScroll() {
+ function spyOnAnchorScroll() {
return function($provide) {
- autoScrollSpy = jasmine.createSpy('$autoScroll');
- $provide.value('$autoScroll', autoScrollSpy);
+ autoScrollSpy = jasmine.createSpy('$anchorScroll');
+ $provide.value('$anchorScroll', autoScrollSpy);
};
}
@@ -247,20 +247,20 @@ describe('widget', function() {
};
}
- beforeEach(module(spyOnAutoScroll()));
+ beforeEach(module(spyOnAnchorScroll()));
beforeEach(inject(
putIntoCache('template.html', 'CONTENT'),
putIntoCache('another.html', 'CONTENT')));
- it('should call $autoScroll if autoscroll attribute is present', inject(
+ it('should call $anchorScroll if autoscroll attribute is present', inject(
compileAndLink('<ng:include src="tpl" autoscroll></ng:include>'),
changeTplAndValueTo('template.html'), function() {
expect(autoScrollSpy).toHaveBeenCalledOnce();
}));
- it('should call $autoScroll if autoscroll evaluates to true', inject(
+ it('should call $anchorScroll if autoscroll evaluates to true', inject(
compileAndLink('<ng:include src="tpl" autoscroll="value"></ng:include>'),
changeTplAndValueTo('template.html', true),
changeTplAndValueTo('another.html', 'some-string'),
@@ -270,14 +270,14 @@ describe('widget', function() {
}));
- it('should not call $autoScroll if autoscroll attribute is not present', inject(
+ it('should not call $anchorScroll if autoscroll attribute is not present', inject(
compileAndLink('<ng:include src="tpl"></ng:include>'),
changeTplAndValueTo('template.html'), function() {
expect(autoScrollSpy).not.toHaveBeenCalled();
}));
- it('should not call $autoScroll if autoscroll evaluates to false', inject(
+ it('should not call $anchorScroll if autoscroll evaluates to false', inject(
compileAndLink('<ng:include src="tpl" autoscroll="value"></ng:include>'),
changeTplAndValueTo('template.html', false),
changeTplAndValueTo('template.html', undefined),