Rails似乎没有为单元或功能测试加载任何灯具.我有一个简单的'products.yml'解析并显示正确:
ruby:
title: Programming Ruby 1.9
description:
Ruby is the fastest growing and most exciting dynamic
language out there. If you need to get working programs
delivered fast, you should add Ruby to your toolbox.
price: 49.50
image_url: ruby.png
Run Code Online (Sandbox Code Playgroud)
我的控制器功能测试开始于:
require 'test_helper'
class ProductsControllerTest < ActionController::TestCase
fixtures :products
setup do
@product = products(:one)
@update = {
:title => 'Lorem Ipsum' ,
:description => 'Wibbles are fun!' ,
:image_url => 'lorem.jpg' ,
:price => 19.95
}
end …Run Code Online (Sandbox Code Playgroud) 我正在使用带有jquery和bootstrap的datatables.net数据网格.我有一大块JSON数据,其中包含一些布尔列,并希望将一个数据表列呈现为已选中或未选中的复选框(当然所有都带有引导样式).这样做最简单/最快的是什么?
我有一个handontable对象(实际上是两个对象,都在一个bootstrap模式中),在构建页面后加载了数据.这是一个重复问题的jsfiddle https://jsfiddle.net/mtbdeano/w7dofbyy/
即使有stretchH: all选择,这些表的尺寸也太窄了.点击内容后,他们会像魔术一样调整到正确的列宽.我错过了一些初始化参数吗?加载新数据后,如何将其大小设置为正确的宽度?
/* these tables are in the modal */
$('#keyword_table').handsontable({
data: keyword_data,
rowHeaders: true,
colHeaders: ['Keywords'],
columnSorting: true,
contextMenu: true,
height: 256,
stretchH: "last",
enterBeginsEditing: false,
minSpareRows: 1
});
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码加载数据,该代码在成功的ajax调用时调用:
function load_table_from_ajax(tbl, data) {
var $tbl = $(tbl);
var hot = $tbl.handsontable('getInstance');
// this formats my data appropriately
var new_data = _.map(data, function (kw) {
return new Array(kw);
});
hot.loadData(new_data);
/* I have tried also doing a: hot.render(); */
}
Run Code Online (Sandbox Code Playgroud)
所有代码看起来都是正确的教程,任何想法为什么表不能正确拉伸/调整大小?