Skip to content
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

\r in toString messes up tabled scenario #178

Closed
nikowitt opened this issue Dec 22, 2015 · 4 comments
Closed

\r in toString messes up tabled scenario #178

nikowitt opened this issue Dec 22, 2015 · 4 comments
Assignees
Milestone

Comments

@nikowitt
Copy link
Contributor

Hi Jan,

    @Test
    @DataProvider(splitBy = __, value = {
            "Test" + __ + "<p>Test</p>",
            "<p>Test</p>" + __ + "<p>Test</p>",
            "<p>Test 1\nTest 2</p>" + __ + "<p>Test 1<br>Test 2</p>",
            "<p>Test 1\nTest 2\r\nTest 3</p>" + __ + "<p>Test 1<br>Test 2\r<br>Test 3</p>",
    })
    @CaseDescription("convertNonHtmlStringToTinyMceString(\"$0\")")
    public void convert_non_html_string_to_tiny_mce_html(String input, String output) throws Exception {
        assert_that().assert_expression(JAFStringUtils.convertNonHtmlStringToTinyMceString(input), is(output));
    }

results in:

Test Class: com.sobis.jaf.tests.tools.JAFStringUtilsTest

 Scenario: convert non html string to tiny mce html

   Assert that <output> <matcher>

  Cases:

    | # | Description                                        | output                             | matcher                                  | Status  |
    +---+----------------------------------------------------+------------------------------------+------------------------------------------+---------+
    | 1 | convertNonHtmlStringToTinyMceString("Test")        | <p>Test</p>                        | is "<p>Test</p>"                         | Success |
    | 2 | convertNonHtmlStringToTinyMceString("<p>Test</p>") | <p>Test</p>                        | is "<p>Test</p>"                         | Success |
    | 3 | convertNonHtmlStringToTinyMceString("<p>Test 1     | <p>Test 1<br>Test 2</p>            | is "<p>Test 1<br>Test 2</p>"             | Success |
    |   | Test 2</p>")                                       |                                    |                                          |         |
    | 4 | convertNonHtmlStringToTinyMceString("<p>Test 1     | <p>Test 1<br>Test 2
<br>Test 3</p> | is "<p>Test 1<br>Test 2\r<br>Test 3</p>" | Success |
    |   | Test 2
                                            |                                    |                                          |         |
    |   | Test 3</p>")                                       |                                    |                                          |         |

For \n, it is already fixed, but Windows users frequently encouter \r where the same should be applied.

@janschaefer
Copy link
Contributor

I agree :-)

@janschaefer janschaefer added this to the v0.10.2 milestone Dec 22, 2015
@janschaefer janschaefer self-assigned this Dec 22, 2015
@nikowitt
Copy link
Contributor Author

Just tried again with the snapshot:

    | # | Description                                        | output                             | matcher                                  | Status  |
    +---+----------------------------------------------------+------------------------------------+------------------------------------------+---------+
    | 1 | convertNonHtmlStringToTinyMceString("Test")        | <p>Test</p>                        | is "<p>Test</p>"                         | Success |
    | 2 | convertNonHtmlStringToTinyMceString("<p>Test</p>") | <p>Test</p>                        | is "<p>Test</p>"                         | Success |
    | 3 | convertNonHtmlStringToTinyMceString("<p>Test 1     | <p>Test 1<br>Test 2</p>            | is "<p>Test 1<br>Test 2</p>"             | Success |
    |   | Test 2</p>")                                       |                                    |                                          |         |
    | 4 | convertNonHtmlStringToTinyMceString("<p>Test 1     | <p>Test 1<br>Test 2
<br>Test 3</p> | is "<p>Test 1<br>Test 2\r<br>Test 3</p>" | Success |
    |   | Test 2                                             |                                    |                                          |         |
    |   | Test 3</p>")                                       |                                    |                                          |         |

Better, but not still not perfect :)

@nikowitt nikowitt changed the title \r in toString mess up tabled scenario \r in toString messes up tabled scenario Dec 23, 2015
@janschaefer
Copy link
Contributor

Yes. I have not handled the case of a single carriage return. Do you think that this might actually happen in practice?

@nikowitt
Copy link
Contributor Author

At least in the current state of the conversion method this might happen - of course I could also adapt this in the implementation to convert both \n and \r\n to breaks which is probably better.

@janschaefer janschaefer modified the milestones: v0.11.0, v0.10.2 Dec 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants