我的功能import XCTest
class test: XCTestCase {
var myview: MyUIView!
override func setUp() {
super.setUp()
myview = MyUIView()
}
func testA() {
let kom = myview.foo()
XCTAssertEqual(kom, "hello") // how do I mock this with "hello"
}
func testB() {
let kom = myview.foo()
XCTAssertEqual(kom, "weekend") // how do I mock this with "weekend"
}
func testC() {
let kom = myview.foo()
XCTAssertEqual(kom, "swift") // how do I mock this with "swift"
}
}
有点问题。实际上,它不起作用:(
这是我的代码:
HTML
Host gitlab_perso
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentitiesOnly yes
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/perso/id_rsa
Host gitlab.com
Hostname gitlab.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
JS
scrollIntoView
有人知道出了什么问题吗? 非常感谢!
答案 0 :(得分:0)
在我看来,正在按预期添加fadeInLeft
类。但是,您需要一个额外的大括号和右括号来关闭文档就绪事件处理程序:
$(document).ready(function() {
function isScrolledIntoView(elem) {
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
$(window).scroll(function() {
$('.scroll-animations .animated').each(function() {
if (isScrolledIntoView(this) === true) {
$(this).addClass('fadeInLeft');
}
});
});
}); // This was missing
您还需要确保在JavaScript执行之前加载jQuery。最简单的方法是在页面的<head>
元素中放置这样的内容:
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>