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

Add Flowsupport stub into lightning stubs #244

Open
jefersonchaves opened this issue Sep 16, 2021 · 4 comments
Open

Add Flowsupport stub into lightning stubs #244

jefersonchaves opened this issue Sep 16, 2021 · 4 comments

Comments

@jefersonchaves
Copy link

Description

Steps to Reproduce

// simplified test case
it('navigates to next event ...', () => {
    ...
});
// JS for component under test
import { LightningElement } from 'lwc';
import { FlowNavigationNextEvent } from "lightning/flowSupport";

export default class Foo extends LightningElement {
    goToNextStep() {
        this.dispatchEvent(new FlowNavigationNextEvent());
    }
}

Expected Results

Being able to test components that use lightning/flowSupport and potentially validate that event was dispatched.

Actual Results

Cannot find module 'lightning/flowSupport' from 'force-app'

Version

  • @salesforce/sfdx-lwc-jest: 1.0.1
  • Node: 14.17.5

Possible Solution

I currently added the following stub but is incomplete and requires duplication for the projects - I can happily submit a pull request for review (this was my starting point):

export const FlowAttributeChangeEventName = 'lightning__flowattributechange';

export class FlowAttributeChangeEvent extends CustomEvent {
 constructor(attributeName, attributeValue) {
    super(FlowAttributeChangeEventName, {
        composed: true,
        cancelable: true,
        bubbles: true,
        detail: {
            attributeName,
            attributeValue
        }
    });
  }
}

export const FlowNavigationNextEventName = 'lightning__flownextevent';

export class FlowNavigationNextEvent extends CustomEvent {
 constructor(attributeName, attributeValue) {
    super(FlowNavigationNextEventName, {
        composed: true,
        cancelable: true,
        bubbles: true,
        detail: {
            attributeName,
            attributeValue
        }
    });
  }
}
@djsing
Copy link

djsing commented May 8, 2022

@jefersonchaves Would you mind sharing your completed stub? I assume you completed your stub since then, but I can't seem to find your PR. It would really help me :) thanks. If you can't, the above is still a good starting point.

PS. its kind of crazy that no one has responded to such a needed issue

@jefersonchaves
Copy link
Author

Hello @djsing - To be honest I got involved into other projects and I feel I have never submitted a PR. The starting point still what I described here. I hope it helps you.

@rgoodman22
Copy link

with the release of the lightning/flow module it would be great if that could be supported as well.

@jonnypetraglia
Copy link

Is this ever intended to be doable, and if not what alternative for testing is officially recommended?

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

No branches or pull requests

4 participants