Skip to content

Commit

Permalink
core: OSS TensorBoard page title should be TensorBoard (#5190)
Browse files Browse the repository at this point in the history
* core: OSS TensorBoard page title should be `TensorBoard`

* set OSS default experiment name to be ''

  Remove the explicit definition and check for OSS brand name, this will
  make it easy to support custom page titles in OSS in the future (if
  desired).
  • Loading branch information
yatbear committed Aug 4, 2021
1 parent f722424 commit 449273b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions tensorboard/webapp/core/views/page_title_test.ts
Expand Up @@ -187,3 +187,47 @@ describe('page title test with custom brand names', () => {
expect(spy).toHaveBeenCalledWith('TensorBoard.corp');
});
});

describe('page title test for OSS TensorBoard', () => {
let store: MockStore<State>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [PageTitleModule],
declarations: [TestingComponent],
providers: [
provideMockStore(),
{
provide: TB_BRAND_NAME,
useValue: 'TensorBoard',
},
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();

store = TestBed.inject<Store<State>>(Store) as MockStore<State>;
store.overrideSelector(getRouteKind, RouteKind.EXPERIMENTS);
store.overrideSelector(getExperimentIdsFromRoute, []);
store.overrideSelector(getExperiment, null);
store.overrideSelector(getEnvironment, {
data_location: 'my-location',
window_title: '',
});
});

it('uses `TensorBoard` for experiment page title', () => {
const spy = spyOn(TEST_ONLY.utils, 'setDocumentTitle');
store.overrideSelector(getRouteKind, RouteKind.EXPERIMENT);
store.overrideSelector(getExperimentIdsFromRoute, ['defaultExperimentId']);
store.overrideSelector(
getExperiment,
buildExperiment({
name: '', // OSS default experiment name is ''
})
);
const fixture = TestBed.createComponent(TestingComponent);
fixture.detectChanges();

expect(spy).toHaveBeenCalledWith('TensorBoard');
});
});
Expand Up @@ -25,7 +25,7 @@ import {ExperimentsDataState, ExperimentsState} from './experiments_types';

const defaultExperiment = {
id: DEFAULT_EXPERIMENT_ID,
name: 'Default experiment',
name: '',
start_time: 0,
};

Expand Down

0 comments on commit 449273b

Please sign in to comment.