-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into kurt-refactor-client-side-…
…scene
- Loading branch information
Showing
11 changed files
with
169 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { DeepPartial } from 'lib/types' | ||
import { Configuration } from 'wasm-lib/kcl/bindings/Configuration' | ||
import { | ||
configurationToSettingsPayload, | ||
projectConfigurationToSettingsPayload, | ||
setSettingsAtLevel, | ||
} from './settingsUtils' | ||
import { createSettings } from './initialSettings' | ||
|
||
describe(`testing settings initialization`, () => { | ||
it(`sets settings at the 'user' level`, () => { | ||
let settings = createSettings() | ||
const appConfiguration: DeepPartial<Configuration> = { | ||
settings: { | ||
app: { | ||
appearance: { | ||
theme: 'dark', | ||
color: 190, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
const appSettingsPayload = configurationToSettingsPayload(appConfiguration) | ||
|
||
setSettingsAtLevel(settings, 'user', appSettingsPayload) | ||
|
||
expect(settings.app.theme.current).toBe('dark') | ||
expect(settings.app.themeColor.current).toBe('190') | ||
}) | ||
|
||
it(`doesn't read theme from project settings`, () => { | ||
let settings = createSettings() | ||
const appConfiguration: DeepPartial<Configuration> = { | ||
settings: { | ||
app: { | ||
appearance: { | ||
theme: 'dark', | ||
color: 190, | ||
}, | ||
}, | ||
}, | ||
} | ||
const projectConfiguration: DeepPartial<Configuration> = { | ||
settings: { | ||
app: { | ||
appearance: { | ||
theme: 'light', | ||
color: 200, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
const appSettingsPayload = configurationToSettingsPayload(appConfiguration) | ||
const projectSettingsPayload = | ||
projectConfigurationToSettingsPayload(projectConfiguration) | ||
|
||
setSettingsAtLevel(settings, 'user', appSettingsPayload) | ||
setSettingsAtLevel(settings, 'project', projectSettingsPayload) | ||
|
||
// The 'project'-level for `theme` setting should be ignored completely | ||
expect(settings.app.theme.current).toBe('dark') | ||
// But the 'project'-level for `themeColor` setting should be applied | ||
expect(settings.app.themeColor.current).toBe('200') | ||
}) | ||
}) |
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