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 support for data-tag-name attribute on handlebars script tag #299

Merged
merged 7 commits into from
Jan 5, 2012
Merged

add support for data-tag-name attribute on handlebars script tag #299

merged 7 commits into from
Jan 5, 2012

Conversation

pangratz
Copy link
Member

Inspired by question http://stackoverflow.com/questions/8629287/how-do-you-specify-the-tag-name-for-sproutcore-emberjs-inline-script-templates I've added support for data-tag-name which defines the tagName on the view created for a handlebars template.

Example:

<script type="text/x-handlebars" data-tag-name="h1" >
    Foo
</script>

which outputs

<h1>Foo</h1>

@wagenet
Copy link
Member

wagenet commented Dec 29, 2011

Is this something we can write tests for? I can't recall if we have tests for loader.js but if we do we should definitely add to them. If not, I guess you're off the hook, though we should still write tests.

test("scripts with data-template-name should be added to Ember.TEMPLATES", function() {
});

test("templates with data-tag-name should create templates with specific tag name", function() {
Copy link
Member Author

Choose a reason for hiding this comment

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

How can I test a custom HTML page with QUnit?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not expecting that you'd be able to make a full integration level test, just that you may be able to test some of the pieces.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, kind of difficult with how the Ember.Handlebars.bootstrap looks like https://github.com/emberjs/ember.js/blob/master/packages/ember-handlebars/lib/loader.js

Do you have any suggestions?

@pangratz
Copy link
Member Author

OK, I've added some tests for the data-template-name and data-tag-name features.

wycats added a commit that referenced this pull request Jan 5, 2012
add support for data-tag-name attribute on handlebars script tag
@wycats wycats merged commit f48c903 into emberjs:master Jan 5, 2012
@pangratz pangratz deleted the add_tag_name branch November 14, 2013 19:19
sandstrom pushed a commit to sandstrom/ember.js that referenced this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants