我正在尝试在ReactJS中设置脉动动画的关键帧.我尝试在内联样式中设置关键帧,但这不起作用.
const NewRelpyheButton = ({style = {}, open, handleOPenSettings}) => {
var bar = {
color: '#000',
padding: '1em 0',
fontSize: '20px',
textAlign: 'center',
cursor: 'pointer',
position: 'fixed',
bottom: '0',
width: '100%',
zIndex: '10',
animation: 'pulse 1.2s ease-in-out',
animationIterationCount: 'infinite',
}
Object.assign(style, {});
let openModal;
if (open) {
openModal = <Modal><NewRelpyhe/></Modal>
}
return (
<div>
{openModal}
<Bar color='purple' style={bar} onClick={handleOpenSettings}>
create a new relphye site
</Bar></div>
)
}
Run Code Online (Sandbox Code Playgroud)
我试图在css中模仿这个:
.element {
width: 100%;
height: 100%;
animation: pulse …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚是否有一种方法可以在不使用 jQuery/JS 的情况下防止在存在“:focus:active”或单击事件时应用“:focus”伪类的样式。由于“:active”状态依赖于“:focus”状态,我认为“:focus:not(:active)”有效,但事实并非如此。有没有办法将“:not”与“:focus”结合起来,以防止“focus:active”触发“焦点”?
我正在尝试为我的Mongoose模型创建一些测试,我无法弄清楚如何让Jest/Mockgoose测试通过我创建的用于检索的速记查询/聚合管道(参见下面的第一个代码块)来自一个集合的随机文档,该文档未在另一个集合中引用.
activitySchema.query.getUnused = function() {
return Activity.aggregate()
.lookup({
from: 'userActivity',
localField: '_id',
foreignField: 'activity',
as: 'matched_docs',
})
.match({ matched_docs: { $eq: [] } })
.sample(1)
.project({ matched_docs: 0, __v: 0 })
.exec()
}
Run Code Online (Sandbox Code Playgroud)
开玩笑测试
describe('Activity methods', () => {
test('Activity unused query executes', (done) => {
function createActivity() {
return Activity
.create({ activity: 'running' })
.then(activity => {
console.log('Activity is generated')
return Promise.resolve(true)
})
}
async function retrieveActivity() {
await createActivity()
Activity
.find()
.getUnused()
.then(unused => {
console.log(unused);
expect(unused).toHaveLength(1)
done() …Run Code Online (Sandbox Code Playgroud)