mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: In development, refresh client when theme changes are made (#22978)
This brings the theme development experience (via the discourse_theme cli) closer to the experience of making javascript changes in Discourse core/plugins via Ember CLI. Whenever a change is made to a non-css theme field, all clients will be instructed to immediately refresh via message-bus.
This commit is contained in:
@@ -1093,4 +1093,30 @@ HTML
|
||||
expect(messages.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
describe "development experience" do
|
||||
it "sends 'development-mode-theme-changed event when non-css fields are updated" do
|
||||
Theme.any_instance.stubs(:should_refresh_development_clients?).returns(true)
|
||||
|
||||
theme.set_field(target: :common, name: :scss, value: "body {background: green;}")
|
||||
|
||||
messages =
|
||||
MessageBus
|
||||
.track_publish { theme.save! }
|
||||
.filter { |m| m.channel == "/file-change" }
|
||||
.map(&:data)
|
||||
|
||||
expect(messages).not_to include("development-mode-theme-changed")
|
||||
|
||||
theme.set_field(target: :common, name: :header, value: "<p>Hello world</p>")
|
||||
|
||||
messages =
|
||||
MessageBus
|
||||
.track_publish { theme.save! }
|
||||
.filter { |m| m.channel == "/file-change" }
|
||||
.map(&:data)
|
||||
|
||||
expect(messages).to include(["development-mode-theme-changed"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user