Skip to content

Commit

Permalink
Add assertion to verify preprocessor was run on create-ref modifier (#65
Browse files Browse the repository at this point in the history
)

Co-authored-by: Cyril Fluck <github@fluck.fr>
  • Loading branch information
jasonbekolay and cyril-sf committed Dec 13, 2023
1 parent e51cd21 commit 95aa1d0
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 95aa1d0

Please sign in to comment.