Sha256: 9e2f25389e75e773fbdb9d9991182e9b85c4d9398703bdd978ad5cb452288bb2
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'test_helper' require 'netzke_core' require 'netzke/properties_tool' require 'netzke/container' require 'netzke/accordion' require 'netzke/grid_interface' require 'netzke/grid_js_builder' require 'netzke/grid' require 'netzke/ar_ext' require 'netzke/column' class GridTest < ActiveSupport::TestCase test "interface" do grid = Netzke::Grid.new(:name => 'grid', :data_class_name => 'Book', :layout_manager => false, :columns => [:id, :title, :recent]) # post grid.post_data(:created_records => [{:title => 'Lord of the Rings'}].to_json) assert_equal('Lord of the Rings', Book.first.title) grid.post_data(:updated_records => [{:id => Book.first.id, :title => 'Lolita'}].to_json) assert_equal('Lolita', Book.first.title) grid.post_data(:created_records => [{:title => 'Upanishad'}].to_json) # get data = grid.get_data assert_equal('Lolita', data[:data][0][1]) # title of the first book assert_equal('Yes', data[:data][1][2]) # "recent" virtual column in the second book # delete res = grid.delete_data(:records => [1,2].to_json) assert_equal(true, res[:success]) assert_equal(nil, Book.first) end # TODO: add tests with association columns end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
skozlov-netzke_basepack-0.1.0 | test/grid_test.rb |
skozlov-netzke_core-0.1.0 | test/grid_test.rb |