mirror of
https://github.com/plausible/analytics.git
synced 2024-09-11 18:07:33 +03:00
Actually enforce proper WordPress spelling (#3710)
This commit is contained in:
parent
730c8edc4a
commit
0a124e69e7
@ -27,7 +27,7 @@ defmodule PlausibleWeb.Live.Plugins.API.Settings do
|
||||
assign(socket,
|
||||
domain: domain,
|
||||
add_token?: not is_nil(session["new_token"]),
|
||||
token_description: String.capitalize(session["new_token"] || ""),
|
||||
token_description: session["new_token"] || "",
|
||||
current_user_id: user_id
|
||||
)}
|
||||
end
|
||||
|
@ -162,11 +162,11 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
site_id: site.domain,
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
res = json_response(conn, 200)
|
||||
assert res["name"] == "Wordpress"
|
||||
assert res["name"] == "WordPress"
|
||||
assert String.starts_with?(res["url"], "http://")
|
||||
end
|
||||
|
||||
@ -182,11 +182,11 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
site_id: old_domain,
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
res = json_response(conn, 200)
|
||||
assert res["name"] == "Wordpress"
|
||||
assert res["name"] == "WordPress"
|
||||
assert String.starts_with?(res["url"], "http://")
|
||||
end
|
||||
|
||||
@ -194,7 +194,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
site_id: site.domain,
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
%{"url" => url} = json_response(conn, 200)
|
||||
@ -202,7 +202,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
site_id: site.domain,
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
assert %{"url" => ^url} = json_response(conn, 200)
|
||||
@ -211,7 +211,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
test "returns 400 when site id missing", %{conn: conn} do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
res = json_response(conn, 400)
|
||||
@ -221,7 +221,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
test "returns 404 when site id is non existent", %{conn: conn} do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
name: "Wordpress",
|
||||
name: "WordPress",
|
||||
site_id: "bad"
|
||||
})
|
||||
|
||||
@ -244,7 +244,7 @@ defmodule PlausibleWeb.Api.ExternalSitesControllerTest do
|
||||
conn =
|
||||
put(conn, "/api/v1/sites/shared-links", %{
|
||||
site_id: site.domain,
|
||||
name: "Wordpress"
|
||||
name: "WordPress"
|
||||
})
|
||||
|
||||
res = json_response(conn, 404)
|
||||
|
@ -66,7 +66,7 @@ defmodule PlausibleWeb.Live.PluginsAPISettingsTest do
|
||||
end
|
||||
|
||||
test "add token button is rendered", %{conn: conn, site: site} do
|
||||
conn = get(conn, "/#{site.domain}/settings/integrations?new_token=Wordpress")
|
||||
conn = get(conn, "/#{site.domain}/settings/integrations?new_token=WordPress")
|
||||
resp = html_response(conn, 200)
|
||||
|
||||
assert element_exists?(resp, ~s/button[phx-click="add-token"]/)
|
||||
@ -78,11 +78,11 @@ defmodule PlausibleWeb.Live.PluginsAPISettingsTest do
|
||||
|
||||
test "create token form shows up invoked via URL", %{conn: conn, site: site} do
|
||||
{_lv, html} =
|
||||
get_liveview(conn, site, with_html?: true, query_params: "?new_token=Wordpress")
|
||||
get_liveview(conn, site, with_html?: true, query_params: "?new_token=WordPress")
|
||||
|
||||
assert element_exists?(html, "#token-form")
|
||||
assert text_of_element(html, "label[for=token_description]") == "Description"
|
||||
assert element_exists?(html, "input[value=Wordpress]#token_description")
|
||||
assert element_exists?(html, "input[value=WordPress]#token_description")
|
||||
assert text_of_element(html, "label[for=token-clipboard]") == "API Token"
|
||||
assert element_exists?(html, "input#token-clipboard")
|
||||
|
||||
@ -95,7 +95,7 @@ defmodule PlausibleWeb.Live.PluginsAPISettingsTest do
|
||||
test "adds token", %{conn: conn, site: site} do
|
||||
refute Tokens.any?(site)
|
||||
|
||||
lv = get_liveview(conn, site, query_params: "?new_token=Wordpress")
|
||||
lv = get_liveview(conn, site, query_params: "?new_token=WordPress")
|
||||
|
||||
lv
|
||||
|> find_live_child("token-form")
|
||||
@ -105,7 +105,7 @@ defmodule PlausibleWeb.Live.PluginsAPISettingsTest do
|
||||
assert Tokens.any?(site)
|
||||
|
||||
html = render(lv)
|
||||
assert text_of_element(html, "span.token-description") == "Wordpress"
|
||||
assert text_of_element(html, "span.token-description") == "WordPress"
|
||||
end
|
||||
|
||||
test "fails to add token with no description", %{conn: conn, site: site} do
|
||||
|
Loading…
Reference in New Issue
Block a user