How to use ember-cli-flash - 9 common examples

To help you get started, we’ve selected a few ember-cli-flash 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 code-corps / code-corps-ember / tests / helpers / flash-message.js View on Github external
import { getOwner } from '@ember/application';
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({ init() {} });

export function getFlashMessageCount(context) {
  return getTestContainer(context).lookup('service:flash-messages').get('queue').length;
}

export function getFlashMessageAt(index, context) {
  return getTestContainer(context).lookup('service:flash-messages').get('queue')[index];
}

function getTestContainer(context) {
  if (context.application) { // acceptance test
    return context.application.__container__;
  } else { // integration/unit test
    return getOwner(context);
  }
}
github hashicorp / vault / ui / app / components / flash-message.js View on Github external
import { computed } from '@ember/object';
import FlashMessage from 'ember-cli-flash/components/flash-message';

export default FlashMessage.extend({
  // override alertType to get Bulma specific prefix
  //https://github.com/poteto/ember-cli-flash/blob/master/addon/components/flash-message.js#L35
  alertType: computed('flash.type', {
    get() {
      const flashType = this.flash.type || '';
      let prefix = 'is-';

      return `${prefix}${flashType}`;
    },
  }),
});
github exercism / gui / tests / helpers / flash-message.js View on Github external
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({ init() {} });
github ilios / frontend / tests / helpers / flash-message.js View on Github external
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({ init() {} });
github adiwg / mdEditor / tests / helpers / flash-message.js View on Github external
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({
  init() {
    return this;
  }
});
github TruthfulTechnology / unicode.party / tests / helpers / flash-message.js View on Github external
import FlashObject from 'ember-cli-flash/flash/object';

FlashObject.reopen({_setInitialState: null});
github poteto / ember-cli-flash / addon / services / flash-messages.js View on Github external
const defaults = objectWithout(allDefaults, [
      'types',
      'injectionFactories',
      'preventDuplicates'
    ]);

    const flashMessageOptions = assign({}, defaults, { flashService });

    for (let key in options) {
      const value = get(options, key);
      const option = this._getOptionOrDefault(key, value);

      set(flashMessageOptions, key, option);
    }

    return FlashMessage.create(flashMessageOptions);
  },
github poteto / ember-cli-flash / app / initializers / flash-messages.js View on Github external
export function initialize() {
  const application = arguments[1] || arguments[0];
  const { flashMessageDefaults } = config || {};
  const { injectionFactories } = flashMessageDefaults || [];
  const options = flashMessageOptions(flashMessageDefaults);
  const shouldShowDeprecation = !(injectionFactories && injectionFactories.length);

  deprecate(INJECTION_FACTORIES_DEPRECATION_MESSAGE, shouldShowDeprecation, {
    id: 'ember-cli-flash.deprecate-injection-factories',
    until: '2.0.0'
  });

  options.injectionFactories.forEach((factory) => {
    application.inject(factory, 'flashMessages', 'service:flash-messages');
  });
}