mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 09:33:44 +08:00
c85018cdfd
* FEATURE: Improve crawler view
* FIX: Make lazyYT crawler-friendly
* DEV: Rename discourse-internet-explorer to discourse-unsupported-browser
* DEV: Detect more unsupported browsers
Follow-up to 4eebbd2212
.
* FIX: Hide browser update notice in print view
38 lines
1.4 KiB
Ruby
38 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe 'Bootstrapping the Discourse App' do
|
|
let(:ie_agent) { "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko" }
|
|
|
|
context "when disabled" do
|
|
before do
|
|
SiteSetting.discourse_unsupported_browser_enabled = false
|
|
end
|
|
|
|
it "does not include the IE stylesheet or Javascript" do
|
|
get "/categories", headers: { "HTTP_USER_AGENT" => ie_agent }
|
|
expect(response.body).not_to match(/discourse-unsupported-browser-optional.js/)
|
|
expect(response.body).not_to match(/stylesheets\/discourse-unsupported-browser/)
|
|
end
|
|
end
|
|
|
|
context "when enabled" do
|
|
before do
|
|
SiteSetting.discourse_unsupported_browser_enabled = true
|
|
end
|
|
|
|
it "includes the IE js and css" do
|
|
get "/categories", headers: { "HTTP_USER_AGENT" => ie_agent }
|
|
expect(response.body).to match(/discourse-unsupported-browser-optional.js/)
|
|
expect(response.body).to match(/stylesheets\/discourse-unsupported-browser/)
|
|
end
|
|
|
|
it "doesn't include IE stuff for non-IE browsers" do
|
|
get "/categories", headers: { "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" }
|
|
expect(response.body).not_to match(/discourse-unsupported-browser-optional.js/)
|
|
expect(response.body).not_to match(/stylesheets\/discourse-unsupported-browser/)
|
|
end
|
|
end
|
|
end
|