How to use the single-spa.LOADING_SOURCE_CODE function in single-spa

To help you get started, we’ve selected a few single-spa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CanopyTax / single-spa / spec / parcels / mount-root-parcel.spec.js View on Github external
it(`lets you call mountParcel with a config loading function instead of an actual parcel config`, () => {
    const parcelConfig = createParcelConfig();
    let resolveConfigLoading
    const configLoadingFunction = () => new Promise(resolve => {
      resolveConfigLoading = () => resolve(parcelConfig)
    })
    const parcel = singleSpa.mountRootParcel(configLoadingFunction, {domElement: document.createElement('div')});
    expect(parcel.getStatus()).toBe(singleSpa.LOADING_SOURCE_CODE);
    return Promise
      .resolve()
      .then(() => expect(parcel.getStatus()).toBe(singleSpa.LOADING_SOURCE_CODE))
      .then(() => resolveConfigLoading())
      .then(() => parcel.loadPromise)
      .then(() => expect(parcel.getStatus()).not.toBe(singleSpa.LOADING_SOURCE_CODE))
      .then(() => parcel.mountPromise)
      .then(() => expect(parcel.getStatus()).toBe(singleSpa.MOUNTED))
      .then(() => parcel.unmount())
      .then(() => expect(parcel.getStatus()).toBe(singleSpa.NOT_MOUNTED))
      .then(() => parcel.unmountPromise)
  })
github CanopyTax / single-spa / spec / parcels / mount-root-parcel.spec.js View on Github external
      .then(() => expect(parcel.getStatus()).toBe(singleSpa.LOADING_SOURCE_CODE))
      .then(() => resolveConfigLoading())