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

[UI Framework] Rename "type" property to "buttonType" #11878

Merged
merged 3 commits into from
May 26, 2017

Conversation

nreese
Copy link
Contributor

@nreese nreese commented May 17, 2017

Fixes #11871

Renames type property to buttonType.

@nreese nreese requested a review from cjcenizal May 17, 2017 19:40
@cjcenizal cjcenizal requested a review from stacey-gammon May 17, 2017 19:41
Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for doing this man. Just had a couple suggestions.

data-test-subj="confirmModalConfirmButton"
type="primary"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we'll need to update confirm_modal.js, which creates instances of KuiButton.

BUTTON_TYPES.forEach(buttonType => {
describe(buttonType, () => {
test(`renders the ${buttonType} class`, () => {
const $button = render(<KuiButton buttonType={buttonType} />);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update the test above this one to be:

    test('HTML attributes are rendered', () => {
      const $button = render(
        <KuiButton
          aria-label="aria label"
          className="testClass1 testClass2"
          data-test-subj="test subject string"
          type="submit"
          disabled
        />
      );

      expect($button)
        .toMatchSnapshot();
    });

This will allow us to test that specifying the prop type="submit" renders as the HTML attribute type="submit".

We'll need to do this with the KuiLinkButton and KuiSubmitButton tests. too.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made one mistake in my original feedback. Other than that, LGTM!

@@ -24,6 +24,7 @@ describe('KuiSubmitButton', () => {
aria-label="aria label"
className="testClass1 testClass2"
data-test-subj="test subject string"
type="submit"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I forgot that this component will always apply the type="submit" attribute. So we can remove this from this test.

@nreese nreese merged commit e439d98 into elastic:master May 26, 2017
@spalger
Copy link
Contributor

spalger commented May 27, 2017

@cjcenizal was this supposed to go to 5.x too? #12050 was tagged with 5.x so I backported it, but this isn't there

@spalger
Copy link
Contributor

spalger commented May 27, 2017

If so, when you backport them will you also revert dbd3c83?

cjcenizal pushed a commit to cjcenizal/kibana that referenced this pull request May 27, 2017
* change type property to buttonType

* Update the tests to assert that the type HTML attribute is supported

* remove type=submit from KuiSubmitButton since component automatically sets type
cjcenizal added a commit that referenced this pull request May 27, 2017
* [UI Framework] Rename "type" property to "buttonType" (#11878)

* change type property to buttonType

* Update the tests to assert that the type HTML attribute is supported

* remove type=submit from KuiSubmitButton since component automatically sets type

* Revert "Revert "Fix use of KuiButtons in Clone Modal.""

This reverts commit dbd3c83.
snide pushed a commit to snide/kibana that referenced this pull request May 30, 2017
* change type property to buttonType

* Update the tests to assert that the type HTML attribute is supported

* remove type=submit from KuiSubmitButton since component automatically sets type
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.

3 participants