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

Use tag-name-is-component helper to remove need for Menu::ItemElement backing class #91

Merged
merged 1 commit into from
Oct 3, 2021

Conversation

GavinJoyce
Copy link
Owner

@GavinJoyce GavinJoyce commented Oct 3, 2021

part of #77 (comment)

This removes the need for the Menu::ItemElement component to have a backing class.

An existing test is covering this: 83796b3#diff-2f1746c8a31c717bfe0069265e1afc57117088ae1761e4a498ecaa6ebc325897R157

import { helper } from '@ember/component/helper';

function tagNameIsComponent([as]) {
return typeof as === 'object';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this to return true for things that aren't components?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically no, but it would be weird for someone to pass an object that isn't a component.

Perhaps there are some other things we could check for on the object? If not, I think this is likely good enough for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, this is a quick win, we can make it more constrained later as the public API declares what is intended anyway

@GavinJoyce GavinJoyce merged commit badcac8 into master Oct 3, 2021
@GavinJoyce GavinJoyce deleted the gj/tag-name-is-component branch October 3, 2021 15:12
@GavinJoyce GavinJoyce changed the title create a tag-name-is-component helper Use tag-name-is-component helper to remove need for Menu::ItemElement backing class Oct 5, 2021
@GavinJoyce GavinJoyce added the enhancement New feature or request label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants