chore: convert hash_location_strategy example to a tested spec

This commit is contained in:
Jesús Rodríguez
2016-08-31 02:02:40 +02:00
committed by Victor Berchet
parent 4c35be3e07
commit fb38fba8f9
2 changed files with 35 additions and 12 deletions

View File

@ -0,0 +1,33 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// #docplaster
// #docregion hash_location_strategy
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {NgModule} from '@angular/core';
// #enddocregion hash_location_strategy
import {TestBed} from '@angular/core/testing';
// #docregion hash_location_strategy
@NgModule({providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}]})
class AppModule {
}
// #enddocregion hash_location_strategy
export function main() {
describe('hash_location_strategy examples', () => {
let locationStrategy: HashLocationStrategy;
beforeEach(() => {
locationStrategy =
TestBed.configureTestingModule({imports: [AppModule]}).get(LocationStrategy);
});
it('hash_location_strategy example works',
() => { expect(locationStrategy.prepareExternalUrl('app/foo')).toBe('#app/foo'); });
});
}