Sha256: db263670b5803e1727ed0f33eb790fa2a8fbf23442b0c959a22ccba974fd117e

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 Bytes

Contents

# :nodoc: all

require 'test/unit'

require 'glue/logger'

require 'og'
require 'nitro/ui/pager'

class RequestMock < Hash
	attr_accessor :query
	
	def initialize
		@query = {}
	end
	
	def get(k, default)
		return self[k] || default
	end
end

class TC_N_UI_Pager < Test::Unit::TestCase
	include Nitro
	
	def setup
	end

	def teardown
	end

	def test_all
		items = [1, 2, 3, 4, 5, 6, 7, 8, 9]
		count = items.size()
		
		request = RequestMock.new()
		pager = UI::Pager.new('tst', request, 2, items)
		
		assert_equal(pager.total_count, count)
		
		# bug: bad rounding.
		
		assert_equal(5, pager.page_count)
		
		# bug: FIXME
		# assert_equal(2, items.size())
		
	end
	
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nitro-0.16.0 test/nitro/ui/tc_pager.rb
nitro-0.17.0 test/nitro/ui/tc_pager.rb
nitro-0.18.0 test/nitro/ui/tc_pager.rb
nitro-0.18.1 test/nitro/ui/tc_pager.rb
nitro-0.19.0 test/nitro/ui/tc_pager.rb