simonmcmanus / speclate

spec objects for sizlate that can render at build, on the server or client.
MIT License
3 stars 1 forks source link

Default spec #32

Closed simonmcmanus closed 7 years ago

simonmcmanus commented 7 years ago

Given the following spec the test component would be on both pages when loading index and clicking contact.

    "/index.html": {
        page: 'home',
        spec: {
            '.test-area': {
                component: 'test'
            }

        }
    },
    "/contact.html": {
        page: 'contact'
    },

Speclate should support a defaultState object which is merged with the page config so the test-area is reset for each page load:

    "/index.html": {
        page: 'home',
        spec: {
            '.test-area': {
                component: 'test'
            }

        }
    },
    "/contact.html": {
        page: 'contact'
    },
   defaultState: {
      spec: { '.test-area': '' }
   }

Clicking index then contact should result in an empty test-area

Investigate https://github.com/simonmcmanus/speclate/issues/31 first

simonmcmanus commented 7 years ago

is this just needed in the client side router?

simonmcmanus commented 7 years ago

defaultSpec is now a thing.