Skip to content

Conversation

TheAlexLichter
Copy link
Member

@TheAlexLichter TheAlexLichter commented Aug 19, 2018

Addresses issues left over in #202, especially that templates in the parent component are applied with child values.

Scenarios:

  • Parent template, child value
  • Parent template, child template, child value
  • Parent template, parent value child template (not sure if even possible, failing test is included)

@TheAlexLichter
Copy link
Member Author

cc @joshukraine, @moltar, @conceptdeluxe


// TODO: Still failing :( Child template won't be applied if child has no content as well

it('properly uses meta templates with one-level-deep nested children template', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This one is still a problem 😞

@joshukraine
Copy link

@manniL Thanks for working on this! 🙂

@codecov
Copy link

codecov bot commented Aug 20, 2018

Codecov Report

Merging #248 into master will increase coverage by 5.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #248      +/-   ##
=========================================
+ Coverage   35.29%   40.3%   +5.01%     
=========================================
  Files          18      18              
  Lines         255     263       +8     
=========================================
+ Hits           90     106      +16     
+ Misses        165     157       -8
Impacted Files Coverage Δ
src/shared/plugin.js 51.72% <ø> (ø) ⬆️
src/shared/getMetaInfo.js 94.64% <100%> (+17.09%) ⬆️
src/shared/constants.js 100% <100%> (ø) ⬆️
src/shared/getComponentOption.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 959f1a7...8672709. Read the comment docs.

@atinux
Copy link
Member

atinux commented Aug 20, 2018

Working on multi nested child with templates to make sure it works perfectly

@atinux
Copy link
Member

atinux commented Aug 20, 2018

Well, at the moment it supports only one child with template, it's fine and more children should not happen in usage. Will see if people need this.

@atinux atinux merged commit de876ae into nuxt:master Aug 20, 2018
@atinux atinux changed the title [WIP] feat: better template support feat: better template support Aug 20, 2018
@TheAlexLichter TheAlexLichter deleted the fix-up-templates branch August 20, 2018 11:05
@conceptdeluxe
Copy link

Works like a charm :)

Thank you so much! 👍 💯

@Sylk
Copy link

Sylk commented Dec 17, 2018

Hey @manniL can I get a use case example of this? Because currently the documentation seems to reflect the older version of how to use this.

@TheAlexLichter
Copy link
Member Author

@Sylk Please check the tests for it for now. Don't have an example ready yet ☺️

@Sylk
Copy link

Sylk commented Dec 17, 2018

I'm fairly new to this, so reading them helped a bit. But to follow up, do I need to apply the following to every instance of og:title or whatever I'm attempting to create a template for?

template: chunk => ${chunk}``

@TheAlexLichter
Copy link
Member Author

@Sylk I've created the example from the tests
https://codesandbox.io/s/038mp9vkov

As you see, App.vue has an og:title set ("Test title") and also a template for it ( template: chunk => `${chunk} - My page).

The child component HelloWorld.vue has just a title set ("An important title!"). But the title (from HelloWorld) applied to the template (from App.vue) will be shown
image

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.

5 participants