-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Problem With the addition of SettingsContext in #249 I inadvertently broke most of our stories since the context wasn't being provided to them # Solution I'm now supplying the ContextProviders component to the stories that need it. This should future-proof things since any new context providers will be added to that component. There are some stories I didn't touch since they weren't erroring, so those ones may need to be updated in the future if they start depending on context values. In the meantime this gets us back on track # Checklist - [x] Ran `lune run test` locally before merging Known errors: ``` flipbook/UserSettings/SettingsContext.spec ● hook › local plugin settings override defaults attempt to index nil with 'value' ReplicatedStorage.flipbook.UserSettings.SettingsContext.spec:58 ● hook › set setting value via context attempt to index nil with 'value' ReplicatedStorage.flipbook.UserSettings.SettingsContext.spec:70 FAIL flipbook/stories.spec ● mount/unmount Hoarcekat.story attempt to index function with 'react' ReplicatedStorage.flipbook.stories.spec:21 Test Suites: 2 failed, 12 passed, 14 total Tests: 3 failed, 67 passed, 70 total Snapshots: 0 total Time: 1.179 s Ran all test suites. ```
- Loading branch information
Showing
18 changed files
with
195 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
local Branding = require("./Branding") | ||
local React = require("@pkg/React") | ||
|
||
local Branding = require("./Branding") | ||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
|
||
return { | ||
summary = "Icon and Typography for flipbook", | ||
controls = {}, | ||
story = React.createElement(Branding), | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
Branding = React.createElement(Branding), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
local Checkbox = require("./Checkbox") | ||
local React = require("@pkg/React") | ||
|
||
local Checkbox = require("./Checkbox") | ||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
|
||
return { | ||
summary = "Generic checkbox used for story controls", | ||
story = React.createElement(Checkbox, { | ||
initialState = true, | ||
onStateChange = function(newState) | ||
print("Checkbox state changed to", newState) | ||
end, | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
Checkbox = React.createElement(Checkbox, { | ||
initialState = true, | ||
onStateChange = function(newState) | ||
print("Checkbox state changed to", newState) | ||
end, | ||
}), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,18 +1,25 @@ | ||
local InputField = require("./InputField") | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local InputField = require("./InputField") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
|
||
return { | ||
story = React.createElement(InputField, { | ||
placeholder = "Enter information...", | ||
autoFocus = true, | ||
onSubmit = function(text) | ||
print(text) | ||
end, | ||
validate = function(text: string) | ||
return #text <= 4 | ||
end, | ||
transform = function(text: string) | ||
return text:upper() | ||
end, | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
InputField = React.createElement(InputField, { | ||
placeholder = "Enter information...", | ||
autoFocus = true, | ||
onSubmit = function(text) | ||
print(text) | ||
end, | ||
validate = function(text: string) | ||
return #text <= 4 | ||
end, | ||
transform = function(text: string) | ||
return text:upper() | ||
end, | ||
}), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
local Searchbar = require("./Searchbar") | ||
|
||
return { | ||
summary = "Searchbar used to search for components", | ||
controls = {}, | ||
story = React.createElement(Searchbar), | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
Searchbar = React.createElement(Searchbar), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,19 +1,26 @@ | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
local Sidebar = require("./Sidebar") | ||
local internalStorybook = require("@root/init.storybook.luau") | ||
|
||
return { | ||
summary = "Sidebar containing brand, searchbar, and component tree", | ||
controls = {}, | ||
story = React.createElement(Sidebar, { | ||
storybooks = { | ||
internalStorybook, | ||
}, | ||
selectStory = function(storyModule) | ||
print(storyModule) | ||
end, | ||
selectStorybook = function(storybook) | ||
print(storybook) | ||
end, | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
Sidebar = React.createElement(Sidebar, { | ||
storybooks = { | ||
internalStorybook, | ||
}, | ||
selectStory = function(storyModule) | ||
print(storyModule) | ||
end, | ||
selectStorybook = function(storybook) | ||
print(storybook) | ||
end, | ||
}), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
local ModuleLoader = require("@pkg/ModuleLoader") | ||
local PluginApp = require("./PluginApp") | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
local PluginApp = require("./PluginApp") | ||
|
||
return { | ||
summary = "The main component that handles the entire plugin", | ||
controls = {}, | ||
story = React.createElement(PluginApp, { | ||
loader = ModuleLoader.new(), | ||
plugin = plugin, | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
PluginApp = React.createElement(PluginApp, { | ||
loader = ModuleLoader.new(), | ||
plugin = plugin, | ||
}), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
local NoStorySelected = require("./NoStorySelected") | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
local NoStorySelected = require("./NoStorySelected") | ||
|
||
return { | ||
story = React.createElement(NoStorySelected), | ||
story = React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
NoStorySelected = React.createElement(NoStorySelected), | ||
}), | ||
} |
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 |
---|---|---|
@@ -1,18 +1,27 @@ | ||
local React = require("@pkg/React") | ||
|
||
local ContextProviders = require("@root/Common/ContextProviders") | ||
local MockPlugin = require("@root/Testing/MockPlugin") | ||
local StoryControls = require("@root/Storybook/StoryControls") | ||
|
||
return { | ||
summary = "Panel for configuring the controls of a story", | ||
story = React.createElement(StoryControls, { | ||
controls = { | ||
foo = "bar", | ||
checkbox = false, | ||
dropdown = { | ||
"Option 1", | ||
"Option 2", | ||
"Option 3", | ||
}, | ||
}, | ||
setControl = function() end, | ||
}), | ||
story = function() | ||
return React.createElement(ContextProviders, { | ||
plugin = MockPlugin.new(), | ||
}, { | ||
StoryControls = React.createElement(StoryControls, { | ||
controls = { | ||
foo = "bar", | ||
checkbox = false, | ||
dropdown = { | ||
"Option 1", | ||
"Option 2", | ||
"Option 3", | ||
}, | ||
}, | ||
setControl = function() end, | ||
}), | ||
}) | ||
end, | ||
} |
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
Oops, something went wrong.