-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TSVB] Use the empty label for / terms (#154647)
## Summary Closes #150993 In case there is a single `/` in the markdown it uses the (empty) label as we are doing in other cases. <img width="808" alt="image" src="https://user-images.githubusercontent.com/17003240/230896158-fbdb2f73-76c3-44a0-8e69-041dadd379a6.png"> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/plugins/vis_types/timeseries/common/empty_label.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { getValueOrEmpty } from './empty_label'; | ||
|
||
describe('getValueOrEmpty', () => { | ||
test('returns the value if not empty or slash value given', () => { | ||
expect(getValueOrEmpty('/test/blog')).toEqual('/test/blog'); | ||
}); | ||
|
||
test('returns (empty) if value is slash', () => { | ||
expect(getValueOrEmpty('/')).toEqual('(empty)'); | ||
}); | ||
|
||
test('returns (empty) if value is empty', () => { | ||
expect(getValueOrEmpty('')).toEqual('(empty)'); | ||
}); | ||
|
||
test('returns (empty) if value is null', () => { | ||
expect(getValueOrEmpty(null)).toEqual('(empty)'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters