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 assertion to verify preprocessor was run on create-ref modifier #65

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion addon/modifiers/create-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Modifier from 'ember-modifier';
import { getOwner } from '@ember/application';

import { action } from '@ember/object';
import { assert } from '@ember/debug';
import { assert, warn } from '@ember/debug';
import {
setGlobalRef,
bucketFor,
Expand Down Expand Up @@ -127,6 +127,11 @@ export default class RefModifier extends Modifier {
this._ctx = ctx;
this._element = element;

warn(
`Preprocessor was not executed on create-ref modifier. If the reference is not set, check that ember-ref-bucket is included in the dependencies (not devDependencies) in package.json.`,
typeof named.debugName === 'string' || !!named.bucket,
{ id: 'ember-ref-bucket.no-preprocessor' }
);
assert(
`You must provide string as first positional argument for {{${named.debugName}}}`,
typeof name === 'string' && name.length > 0
Expand Down
Loading