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

fix(core/workflow-steps): new added step state #459

Merged
merged 8 commits into from
Mar 27, 2023

Conversation

goncalosard
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (yarn build) was run locally and any changes were pushed
  • Unit tests (yarn test) were run locally and passed
  • Visual Regression Tests (yarn visual-regression) were run locally and passed
  • Linting (npm lint) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bug fix
  • Feature
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

GitHub Issue Number: #423

What is the new behavior?

  • Added MutationObserver to check if a new element was added to the slot, it will then update the state of the needed steps.

Used code for testing in Angular

  • app.component.html
<ix-workflow-steps>
  <ix-workflow-step *ngFor="let step of steps" status="{{ step.name }}"
    >Step {{ step.id }}</ix-workflow-step
  >
</ix-workflow-steps>

<ix-button (click)="addstep()">Button</ix-button>
  • app.component.ts
export class AppComponent {
  title = 'angular-test-app';

   steps = [
    {id: 1, name:'done'},
    {id: 2, name:'success'},
    {id: 3, name:'open'},
    {id: 4, name:'warning'},
    {id: 5, name:'error'},
  ];

  public addstep() {
    this.steps.push({ id: 6, name: 'success'})
  
  }
}

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@goncalosard goncalosard linked an issue Mar 21, 2023 that may be closed by this pull request
@goncalosard goncalosard added this to the 1.5.0 milestone Mar 21, 2023
@danielleroux danielleroux added the pull request affects patch version The pull request affects only patch version label Mar 23, 2023
Copy link
Collaborator

@danielleroux danielleroux left a comment

Choose a reason for hiding this comment

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

Just tested it with the following code:

export class MyComponent {
  @State() steps = ['Test'];
  render() {
    return (
      <Host>
        <ix-workflow-steps>
          {this.steps.map((t) => (
            <ix-workflow-step>{t}</ix-workflow-step>
          ))}
        </ix-workflow-steps>
        <ix-button
          onClick={() => {
            this.steps = [...this.steps, 'Test 2', 'test 3'];
          }}
        >
          Add
        </ix-button>
      </Host>
    );
  }
}

The result:

image

@goncalosard
Copy link
Contributor Author

@danielleroux Fixed. Tested with both examples.

@danielleroux
Copy link
Collaborator

@goncalosard I added some unit test cases

@danielleroux danielleroux merged commit 715d50d into main Mar 27, 2023
@danielleroux danielleroux deleted the fix/workflow-step-position branch March 27, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull request affects patch version The pull request affects only patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'ix-workflow-steps': 'first' and 'last' position are not persisted
2 participants