Skip to content

Commit

Permalink
Add test for the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sinaeftekhar committed Jan 2, 2024
1 parent f6eb341 commit e17830a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def install_module(path)

# Temporary fix to overcome the issue with sass-embedded, see:
# https://github.com/decidim/decidim/pull/11074
system("npm i sass-embedded@~1.62.0")
# system("npm i sass-embedded@~1.62.0")
end
end

Expand Down
49 changes: 49 additions & 0 deletions spec/system/expolre_adding_translation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

require "spec_helper"

describe "explore adding translation", type: :system do
let(:organization) { create(:organization) }
let(:user) { create(:user, :admin, :confirmed, organization: organization) }
let!(:translation_set) { create(:translation_set, organization: organization, name: { en: "Dummy set" }) }

context "when the translation value is the list" do
# let!(:translation1) { create(:translation, key: "dummy.translation.one", value: "<ul><li>dummy translation list</li></ul>") }
# let!(:translation2) { create(:translation, key: "dummy.translation.two", value: "dummy translation string") }
let(:translation_hash) do
{
"dummy.translation.one" => "<ul><li>dummy translation list</li></ul>",
"dummy.translation.two" => "dummy translation string"
}
end

before do
switch_to_host(organization.host)
sign_in user
visit decidim_admin_term_customizer.translation_sets_path
click_link "Dummy set"
click_link "Add multiple", match: :first
end

it "Adds the lists properly" do
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(Decidim::TermCustomizer::TranslationDirectory).to receive(:translations_search).with("dummy tran").and_return(translation_hash)
# rubocop:enable RSpec/AnyInstance

fill_in "Search", with: "dummy tran"
li_element = page.find("li", text: "<ul><li>dummy translation list</li></ul>")
within "ul#autoComplete_list_1" do
expect(li_element).not_to have_css(".hide")
expect(page).to have_css("li", text: "<ul><li>dummy translation list</li></ul>")
expect(page).to have_css("li", text: "dummy translation string")
li_element.click
expect(li_element).not_to have_css("li", text: "<ul><li>dummy translation list</li></ul>")
end
within "table.table-list" do
expect(page).to have_css("th", text: "Translation key")
expect(page).to have_css("td", text: "dummy.translation.one")
expect(page).to have_css("td", text: "<ul><li>dummy translation list</li></ul>")
end
end
end
end

0 comments on commit e17830a

Please sign in to comment.