我对 Lua 很陌生,我正在尝试测试我在 Nginx 服务器上运行的脚本。我被推荐 Busted 但我似乎无法弄清楚如何模拟一些本地进口。
Lua 代码导入以下内容:
local http = require "resty.http"
Run Code Online (Sandbox Code Playgroud)
在 test _spec 文件中,我是这样开始的:
package.path = "files/?.lua;spec/?.lua;" .. package.path
_G.http = require('resty.fake_http')
local app = require('app')
Run Code Online (Sandbox Code Playgroud)
我在fake_http.lua里面创建了一个文件spec/resty/http。
但是当我运行一个虚拟测试时,我收到以下错误:
suite spec/app_spec.lua
files/app.lua:3: module 'resty.http' not found:No LuaRocks module found for resty.http
Run Code Online (Sandbox Code Playgroud)
知道我在这里做错了什么吗?
我正在尝试设计 React Bootstrap 导航栏的样式。我能够成功地设置非活动选项卡的样式,但是,我似乎无法到达活动选项卡。我的实时样式是一个单独的 .scss 文件。这是相关的片段:
.navitem {
a {
font-size: 12px;
color: #000;
background-color: #e7e7e7;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-bottom-color: #357ebd;
border-bottom-style: solid;
border-radius: 0px !important;
display: inline-block;
border-bottom-width: 2px;
}
flex: 1;
}
.navitem.active {
background-color: #777777;
}
Run Code Online (Sandbox Code Playgroud)
创建活动 Bootstrap 组件后,其 HTML 如下所示:
<li role="presentation" class="Preview-navitem--19fA7 active"><a role="button" href="#">Preview</a></li>
Run Code Online (Sandbox Code Playgroud)
这是 React render() 方法中的 HTML:
<Nav
className={styles.navbar}
bsStyle="pills"
activeKey={this.state.value}
onSelect={this.handleSelect}
>
<NavItem className={styles.navitem} eventKey="1">Preview</NavItem>
{navItem}
</Nav>
Run Code Online (Sandbox Code Playgroud)
所以,基本上,我可以设置 .navitem 的样式,但不能设置 .active 的样式。知道我怎样才能做到这一点吗?