-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(explorer): do not close truncated parts
- Loading branch information
Showing
4 changed files
with
116 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@kadena/explorer': patch | ||
--- | ||
|
||
Reordering columns to present the first column as the one to link to | ||
|
||
Remove toggling close of truncated content. Will always open so users can no | ||
select and copy |
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
79 changes: 79 additions & 0 deletions
79
packages/apps/explorer/src/utils/__test__/condenseString.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,79 @@ | ||
import { condenseStrings } from '../condenseStrings'; | ||
|
||
describe('condenseString', () => { | ||
const singleWord = | ||
'thisisaverylongstringthatshouldbecondensedthisisaverylongstringthatshouldbecondensed'; | ||
const multiWord = | ||
'thisisaverylongstringthatshouldbecond ensedthisisaverylongstringthatshouldbecondensed thisIsAshorterString'; | ||
|
||
describe('with default options', () => { | ||
it('condenses a single string', () => { | ||
expect(condenseStrings(singleWord)).toBe('thisi…ensed'); | ||
}); | ||
|
||
it('condenses a string with multiple words', () => { | ||
expect(condenseStrings(multiWord)).toBe( | ||
'thisi…econd ensed…ensed thisIsAshorterString', | ||
); | ||
}); | ||
}); | ||
describe('with custom options', () => { | ||
it('minLength 10', () => { | ||
expect(condenseStrings(singleWord, { minLength: 10 })).toBe( | ||
'thisi…ensed', | ||
); | ||
expect(condenseStrings(multiWord, { minLength: 10 })).toBe( | ||
'thisi…econd ensed…ensed thisI…tring', | ||
); | ||
}); | ||
|
||
it('replacement "..."', () => { | ||
expect(condenseStrings(singleWord, { replacement: '...' })).toBe( | ||
'thisi...ensed', | ||
); | ||
expect(condenseStrings(multiWord, { replacement: '...' })).toBe( | ||
'thisi...econd ensed...ensed thisIsAshorterString', | ||
); | ||
}); | ||
|
||
it('startLength 10', () => { | ||
expect(condenseStrings(singleWord, { startLength: 10 })).toBe( | ||
'thisisaver…ensed', | ||
); | ||
expect(condenseStrings(multiWord, { startLength: 10 })).toBe( | ||
'thisisaver…econd ensedthisi…ensed thisIsAshorterString', | ||
); | ||
}); | ||
|
||
it('endLength 10', () => { | ||
expect(condenseStrings(singleWord, { endLength: 10 })).toBe( | ||
'thisi…econdensed', | ||
); | ||
expect(condenseStrings(multiWord, { endLength: 10 })).toBe( | ||
'thisi…ouldbecond ensed…econdensed thisIsAshorterString', | ||
); | ||
}); | ||
|
||
it('all options', () => { | ||
expect( | ||
condenseStrings(singleWord, { | ||
minLength: 40, | ||
replacement: '*.*', | ||
startLength: 5, | ||
endLength: 20, | ||
}), | ||
).toBe('thisi*.*hatshouldbecondensed'); | ||
|
||
expect( | ||
condenseStrings(multiWord, { | ||
minLength: 40, | ||
replacement: '*.*', | ||
startLength: 5, | ||
endLength: 20, | ||
}), | ||
).toBe( | ||
'thisisaverylongstringthatshouldbecond ensed*.*hatshouldbecondensed thisIsAshorterString', | ||
); | ||
}); | ||
}); | ||
}); |
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