aboutsummaryrefslogtreecommitdiffstats
path: root/test/servicesSpec.js
blob: 5a6bcedcafa1d7f1dbbd127baf31fa3d2bdf5de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
describe("services", function(){
  var scope;

  beforeEach(function(){
    scope = createScope({
      $config: {
        'location': {'get':noop, 'set':noop, 'watch':noop}
      }
    }, serviceAdapter(angularService));
  });

  it("should inject $window", function(){
    expect(scope.$window).toEqual(window);
  });

  it("should inject $anchor", function(){
    scope.$anchor('#path?key=value');
    expect(scope.$anchor.path).toEqual("path");
    expect(scope.$anchor.param).toEqual({key:'value'});

    scope.$anchor.path = 'page=http://path';
    scope.$anchor.param = {k:'a=b'};

    expect(scope.$anchor()).toEqual('page=http://path?k=a%3Db');

  });
});