forked from HumanSignal/label-studio-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: LEAP-580: Display non-string values in Text (HumanSignal#1675)
* Fix: LEAP-580: Display non-string values in Text During recent incident fix we missed conversion to string for Text tag's `value` param. * Fix deprecated `substr` to `slice` in `parseValue` * Add cypress test for non-string values --------- Co-authored-by: hlomzik <[email protected]>
- Loading branch information
1 parent
9e751b1
commit 210b3cf
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
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
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
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,37 @@ | ||
import { LabelStudio } from '@heartexlabs/ls-test/helpers/LSF'; | ||
|
||
describe('<Text> tag', () => { | ||
it('Display non-string values', () => { | ||
const config = ` | ||
<View> | ||
<Header>String — usual case</Header> | ||
<Text name="string" value="$string"></Text> | ||
<Header>Float number</Header> | ||
<Text name="number" value="$number"></Text> | ||
<Header>Boolean</Header> | ||
<Text name="bool" value="$bool"></Text> | ||
<Header>Array</Header> | ||
<Text name="array" value="$array"></Text> | ||
<Header value="Crazy header $string $number $bool $array" /> | ||
</View> | ||
`; | ||
|
||
const data = { | ||
string: 'Simple text', | ||
number: 123.45, | ||
bool: false, | ||
array: [1, 2, 3], | ||
}; | ||
|
||
LabelStudio.params() | ||
.config(config) | ||
.data(data) | ||
.withResult([]) | ||
.init(); | ||
|
||
cy.get('.lsf-object').contains('Simple text').should('be.visible'); | ||
cy.get('.lsf-object').contains('123.45').should('be.visible'); | ||
cy.get('.lsf-object').contains('false').should('be.visible'); | ||
cy.get('.lsf-object').contains('1,2,3').should('be.visible'); | ||
}); | ||
}); |