-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hydrate): respect
HydratedFlag
configuration in hydrate script
- Loading branch information
1 parent
f941626
commit fff9935
Showing
9 changed files
with
149 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as d from '@rindo/core/declarations'; | ||
import { mockValidatedConfig } from '@rindo/core/testing'; | ||
import MagicString from 'magic-string'; | ||
|
||
import { appendBuildConditionals } from '../app-data-plugin'; | ||
|
||
function setup() { | ||
const config = mockValidatedConfig(); | ||
const magicString = new MagicString(''); | ||
return { config, magicString }; | ||
} | ||
|
||
describe('app data plugin', () => { | ||
it('should include the fsNamespace in the appended BUILD constant', () => { | ||
const { config, magicString } = setup(); | ||
appendBuildConditionals(config, {}, magicString); | ||
expect(magicString.toString().includes(`export const BUILD = /* ${config.fsNamespace} */`)).toBe(true); | ||
}); | ||
|
||
it.each([true, false])('should include hydratedAttribute when %p', (hydratedAttribute) => { | ||
const conditionals: d.BuildConditionals = { | ||
hydratedAttribute, | ||
}; | ||
const { config, magicString } = setup(); | ||
appendBuildConditionals(config, conditionals, magicString); | ||
expect(magicString.toString().includes(`hydratedAttribute: ${String(hydratedAttribute)}`)).toBe(true); | ||
}); | ||
|
||
it.each([true, false])('should include hydratedClass when %p', (hydratedClass) => { | ||
const conditionals: d.BuildConditionals = { | ||
hydratedClass, | ||
}; | ||
const { config, magicString } = setup(); | ||
appendBuildConditionals(config, conditionals, magicString); | ||
expect(magicString.toString().includes(`hydratedClass: ${String(hydratedClass)}`)).toBe(true); | ||
}); | ||
|
||
it('should append hydratedSelectorName', () => { | ||
const conditionals: d.BuildConditionals = { | ||
hydratedSelectorName: 'boop', | ||
}; | ||
const { config, magicString } = setup(); | ||
appendBuildConditionals(config, conditionals, magicString); | ||
expect(magicString.toString().includes('hydratedSelectorName: "boop"')).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters