FIX: Clicking on login should show login modal (#177)
* FIX: Clicking on login should show login modal * Add system test that shows the login modal appears
This commit is contained in:
parent
b855ce9bb9
commit
c30fea21ef
|
@ -1,17 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import cookie from "discourse/lib/cookie";
|
|
||||||
import DiscourseURL from "discourse/lib/url";
|
|
||||||
import { default as getURL } from "discourse-common/lib/get-url";
|
|
||||||
|
|
||||||
export default Component.extend({
|
|
||||||
classNames: ["login-required", "subscriptions"],
|
|
||||||
actions: {
|
|
||||||
createAccount() {
|
|
||||||
const destinationUrl = window.location.href;
|
|
||||||
const cookiePath = getURL("/");
|
|
||||||
|
|
||||||
cookie("destination_url", destinationUrl, { path: cookiePath });
|
|
||||||
DiscourseURL.redirectTo("/login");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<DButton
|
<DButton
|
||||||
@label="log_in"
|
@label="log_in"
|
||||||
@action={{this.createAccount}}
|
@action={{route-action "showLogin"}}
|
||||||
@icon="user"
|
@icon="user"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary login-required subscriptions"
|
||||||
/>
|
/>
|
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
describe "Subscription products", type: :system do
|
||||||
|
fab!(:admin) { Fabricate(:admin) }
|
||||||
|
fab!(:product) { Fabricate(:product, external_id: "prod_OiKyO6ZMFCIhQa") }
|
||||||
|
|
||||||
|
before { SiteSetting.discourse_subscriptions_enabled = true }
|
||||||
|
|
||||||
|
it "shows the login modal" do
|
||||||
|
visit("/s")
|
||||||
|
|
||||||
|
find("button.login-required.subscriptions").click
|
||||||
|
|
||||||
|
expect(page).to have_css(".modal-container .login-modal")
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue