-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android / iOS] Code blocks are overflowing the app border #44953
Merged
puneetlath
merged 25 commits into
Expensify:main
from
software-mansion-labs:@cdOut/code-report-fixed
Oct 31, 2024
+99
−3
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
92d3147
add handling for wrapped code text for native devices
cdOut ebeed08
fix lint issues
cdOut e8441ef
correct imports and prettier
cdOut 6f2325b
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 5764928
split long singular words into mulltiple strings
cdOut e74c97e
fix prettier and lint errors
cdOut 39a022f
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 44d0d7d
memoize fontSize and infer it from textStyles
cdOut f0aa075
fix lint errors and refactor code
cdOut dae171d
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 1a0e31b
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 00740c4
remove manual memoization in favor of react-compiler
cdOut d4e9810
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 513be86
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 5db19ff
Merge branch 'main' into @cdOut/code-report-fixed
cdOut c6756b3
Merge branch 'main' into @cdOut/code-report-fixed
cdOut a7b0e02
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 30a4176
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 89dc570
Merge branch 'main' into @cdOut/code-report-fixed
cdOut 23e436b
add longer explaination comment
cdOut 66d9dc5
add unit test for splitLongWord
cdOut e9c459b
fix prettier
cdOut 5c66624
fix jsdoc lint errors
cdOut 32ea3fc
fix unit test expected results
cdOut 8b76cc9
remove unexpected output substring from test
cdOut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,47 @@ | ||
import {splitLongWord} from '@components/InlineCodeBlock/WrappedText'; | ||
|
||
describe('splitLongWord', () => { | ||
const testCases = [ | ||
{ | ||
word: 'thissadasdasdsadsadasdadsadasdasdasdasdasdasdasdasdasdsadsadggggggggggggggggg', | ||
maxLength: 4, | ||
output: ['this', 'sada', 'sdas', 'dsad', 'sada', 'sdad', 'sada', 'sdas', 'dasd', 'asda', 'sdas', 'dasd', 'asda', 'sdsa', 'dsad', 'gggg', 'gggg', 'gggg', 'gggg', 'g'], | ||
}, | ||
{ | ||
word: 'https://www.google.com/search?q=google&oq=goog&gs_lcrp=EgZjaHJvbWUqEAgAEAAYgwEY4wIYsQMYgAQyEAgAEAAYgwEY4wIYsQMYgAQyEwgBEC4YgwEYxwEYsQMY0QMYgAQyDQgCEAAYgwEYsQMYgAQyBggDEEUYOzIGCAQQRRg8MgYIBRBFGDwyBggGEEUYPDIGCAcQBRhA0gEHNzM1ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8', | ||
maxLength: 20, | ||
output: [ | ||
'https://www.google.c', | ||
'om/search?q=google&o', | ||
'q=goog&gs_lcrp=EgZja', | ||
'HJvbWUqEAgAEAAYgwEY4', | ||
'wIYsQMYgAQyEAgAEAAYg', | ||
'wEY4wIYsQMYgAQyEwgBE', | ||
'C4YgwEYxwEYsQMY0QMYg', | ||
'AQyDQgCEAAYgwEYsQMYg', | ||
'AQyBggDEEUYOzIGCAQQR', | ||
'Rg8MgYIBRBFGDwyBggGE', | ||
'EUYPDIGCAcQBRhA0gEHN', | ||
'zM1ajBqN6gCALACAA&so', | ||
'urceid=chrome&ie=UTF', | ||
'-8', | ||
], | ||
}, | ||
{ | ||
word: 'superkalifragilistischexpialigetisch', | ||
maxLength: 5, | ||
output: ['super', 'kalif', 'ragil', 'istis', 'chexp', 'ialig', 'etisc', 'h'], | ||
}, | ||
{ | ||
word: 'Este es un ejemplo de texto en español para la prueba', | ||
maxLength: 8, | ||
output: ['Este es ', 'un ejemp', 'lo de te', 'xto en e', 'spañol p', 'ara la p', 'rueba'], | ||
}, | ||
]; | ||
|
||
testCases.forEach(({word, maxLength, output}) => { | ||
test(`should split ${word} into ${output.join()} with maxLength of ${maxLength}`, () => { | ||
expect(splitLongWord(word, maxLength)).toEqual(output); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a unit test for this function? With a handful of different sized strings. To make sure it always returns the array we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added unit test for this function 👍