Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
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}`;
},
}),
});
import FlashObject from 'ember-cli-flash/flash/object';
FlashObject.reopen({ init() {} });
import FlashObject from 'ember-cli-flash/flash/object';
FlashObject.reopen({ init() {} });
import FlashObject from 'ember-cli-flash/flash/object';
FlashObject.reopen({
init() {
return this;
}
});
import FlashObject from 'ember-cli-flash/flash/object';
FlashObject.reopen({_setInitialState: null});
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);
},
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');
});
}