Skip to content

react element support - #98

Open
ls-endurance wants to merge 5 commits into
alibaba:masterfrom
ls-endurance:feature/support_react_elements
Open

react element support#98
ls-endurance wants to merge 5 commits into
alibaba:masterfrom
ls-endurance:feature/support_react_elements

Conversation

@ls-endurance

Copy link
Copy Markdown

Adds support for react elements.

get returns an array that includes strings and elements.

@ls-endurance

Copy link
Copy Markdown
Author

@cwtuan Is there anything else we need to do? I'd like to get this merged in.

@cwtuan

cwtuan commented Nov 7, 2018

Copy link
Copy Markdown
Collaborator

@ls-endurance
Sorry, I'm too busy recently. I will review and merge it ASAP.

@ls-endurance

Copy link
Copy Markdown
Author

:) :) 👍

@richseviora

Copy link
Copy Markdown

I'm also eagerly looking forward to this! Thanks @ls-endurance :)

Also thanks @cwtuan + Alibaba team for the package :)

@cwtuan

cwtuan commented Nov 11, 2018

Copy link
Copy Markdown
Collaborator

@ls-endurance
Did you run npm test for this PR?
It seems that a test case failed.

 FAIL  test/index.js
  ● HTML Message with XSS attack

    expect(received).toBe(expected)

    Expected value to be (using ===):
      "This is<span>&lt;sctipt&gt;alert(1)&lt;/script&gt;</span>"
    Received:
      "This is<span><sctipt>alert(1)</script></span>"

@ls-endurance

Copy link
Copy Markdown
Author

Yes, I ran the tests and noticed this failure.

The failure occurs because the intl object is a singleton. The tests run .init() on every test case, but jest runs tests concurrently. This means that test1 will run init, and test2 will run init right after. If the resulting code doesn't error due to the intl.init options, then the test will pass.

With the introduction of the escapeHTML init code, that test runs its init with escapeHTML on, other tests run with escapeHTML turned off, and that one seems to fail due to concurrency issue i described earlier.

If you'd like me to fix it, i can, but it is separate from this feature.

@cwtuan

cwtuan commented Nov 13, 2018

Copy link
Copy Markdown
Collaborator

Should we run test cases in sequence?

@ls-endurance

Copy link
Copy Markdown
Author

That would work. Creating a new instance per test of ReactIntlUniversal would immediately fix this. The tests should never collide with each other.

@cwtuan

cwtuan commented Dec 16, 2018

Copy link
Copy Markdown
Collaborator

@ls-endurance
I have tried removed all other cases and just run that case("HTML Message with XSS attack"), but the test still failed.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants