Sha256: 65fcb291d96d2e8cec474695cc9f9997abd60820145d72dc91dd2af886850bed

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

# This file is part of Alexandria.
#
# See the file README.md for authorship and licensing information.

require_relative "../../spec_helper"

describe Alexandria::UI::SmartLibraryPropertiesDialog do
  let(:properties_dialog) do
    parent = Gtk::Window.new :toplevel
    loader = Alexandria::LibraryStore.new(TESTDIR)
    smart_library = Alexandria::SmartLibrary.new("Foo", [], :all, loader)
    described_class.new parent, smart_library
  end
  let(:gtk_dialog) { properties_dialog.dialog }

  describe "#acquire" do
    it "works when response is cancel" do
      allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
      properties_dialog.acquire
    end

    it "works when response is ok" do
      allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
      properties_dialog.acquire
    end
  end

  describe "#handle_date_icon_press" do
    let(:date_entry) do
      rule_boxes = properties_dialog.handle_add_rule_clicked
      rule_box = rule_boxes.first
      rule_box.children[3]
    end

    before do
      gtk_dialog.show_all
    end

    it "pops up the calendar widget" do
      properties_dialog.handle_date_icon_press(date_entry,
                                               Gtk::EntryIconPosition::PRIMARY,
                                               nil)
      popup = properties_dialog.instance_variable_get(:@calendar_popup)
      expect(popup).to be_visible
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.9 spec/alexandria/ui/smart_library_properties_dialog_spec.rb
alexandria-book-collection-manager-0.7.8 spec/alexandria/ui/smart_library_properties_dialog_spec.rb
alexandria-book-collection-manager-0.7.7 spec/alexandria/ui/smart_library_properties_dialog_spec.rb