有没有人见过这个,并且知道这意味着什么?
define([
"jquery",
"underscore",
"common/athena/vertical-expanding-carousel"
], function ($, _, AthVertExpandingCarousel) {
describe("common/", function () {
describe("athena/", function () {
describe("athena-vertical-expanding-carousel", function () {
var $fixture,
carousel,
sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
$fixture = $([
"<div id='vert-carousel-test-outer' class='generic_container'>",
"<div id='vert-carousel-test' class='js-vertCarouselMainContainer" +
" vertCarouselMainContainer carousel'>",
" <ol class='js-carousel-items'>",
" <li class='selected'>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" <li>",
" <div><a href='#'><img data-lazy='/static-mock/empty.png' /></a></div>",
" </li>",
" </ol>",
"</div>",
"<div class='paginator-container' id='paginator-container'>",
" <div class='js-up-down-controls'>",
" <div class='js-up-controls'>",
" </div>",
" <div class='js-down-controls'>",
" </div>",
" </div>",
"</div>",
"</div>"
].join("\n")).appendTo($("#fixtures-visible"));
});
afterEach(function () {
$fixture.remove();
sandbox.restore();
if (carousel) {
carousel.remove();
}
});
describe("base case", function () {
it("should not have any new classes indicating initialization if a bad " +
"selector is sent", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($("nada"),
{maxRows: 5});
expect($upDownControls).to
.not
.have.$class("atTop").and
.have.$class("atBottom");
});
it("should have class of atTop and not atBottom in controlls after " +
"being initialized", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
expect($upDownControls)
.to.have.$class("atTop").and
.to.not.have.$class("atBottom");
});
// We may add an init option to start with more than one row,
// but for now we start at 1 row
it("should have class of vertPages1 after being initialized", function () {
var $vertCarouselContainer = $("#vert-carousel-test");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
expect($vertCarouselContainer)
.to.have.$class("vertPages1");
});
it("should have class of vertPages2 and lose the the atTop class " +
"in controls after init and a downclick", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
$upDownControls.find(".js-down-controls").click();
expect($vertCarouselContainer)
.to.have.$class("vertPages2").and
.to.not.have.$class("atTop");
});
it("should have class of atTop and not the atBottom class " +
"after init and an upCLick", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
$upDownControls.find(".js-up-controls").click();
expect($upDownControls)
.to.have.$class("atTop").and
.to.not.have.$class("atBottom");
});
it("should have class of vertPages1 and data value of 1 for vertCarSize " +
"after init and an upCLick", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
$upDownControls.find(".js-up-controls").click();
expect($vertCarouselContainer)
.to.have.$class("vertPages1");
});
it("should have class of vertPages3 and data value of 3 for vertCarSize " +
"after init and TWO downClicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
$upDownControls.find(".js-down-controls").click().click();
expect($vertCarouselContainer)
.to.have.$class("vertPages3");
});
it("should have class of atTop and not atBottom after being initialized, " +
"a downclick and an upclick", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 5});
$upDownControls.find(".js-down-controls").click();
$upDownControls.find(".js-up-controls").click();
expect($upDownControls)
.to.have.$class("atTop").and
.to.not.have.$class("atBottom");
});
it("should have class of atBottom and not atTop after being initialized w " +
"max of 3 rows and two downclicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 3});
$upDownControls.find(".js-down-controls").click().click();
expect($upDownControls)
.to.have.$class("atBottom").and
.to.not.have.$class("atTop");
});
it("should have class of atBottom and not atTop after being initialized w max " +
"of 3 rows and three downclicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer,
{maxRows: 3});
$upDownControls.find(".js-down-controls").click().click();
$upDownControls.find(".js-down-controls").click(); // one too many
expect($upDownControls)
.to.have.$class("atBottom").and
.to.not.have.$class("atTop");
});
it("should have class of atBottom and not atTop after being initialized w NO MAX " +
"rows and three downclicks but not at two downclicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer, {});
$upDownControls.find(".js-down-controls").click().click();
expect($upDownControls)
.to.not.have.$class("atBottom").and
.to.have.$class("atTop");
$upDownControls.find(".js-down-controls").click();
expect($upDownControls)
.to.have.$class("atBottom").and
.to.not.have.$class("atTop");
});
it("should have data value of vertCarSize=4 after being initialized w NO MAX " +
"rows and three downclicks but only 3 after two down clicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer, {});
$upDownControls.find(".js-down-controls").click().click();
expect($vertCarouselContainer).to.have.$class("vertPages3");
$upDownControls.find(".js-down-controls").click();
expect($vertCarouselContainer)
.to.have.$class("vertPages4");
});
it("should have data value of vertCarSize=4 after being initialized w NO SECOND PARAM " +
"rows and 3 downclicks but only three after 2 down clicks", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer);
$upDownControls.find(".js-down-controls").click().click();
expect($vertCarouselContainer).to.have.$class("vertPages3");
$upDownControls.find(".js-down-controls").click();
expect($vertCarouselContainer)
.to.have.$class("vertPages4");
});
it("should have startTransition and then transitionComplete as a class after leaving " +
"atTop", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
sandbox.useFakeTimers();
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer, {});
$upDownControls.find(".js-down-controls").click();
expect($upDownControls).to.have.$class("startTransition");
expect($upDownControls).to.not.have.$class("transitionComplete");
expect($upDownControls).to.not.have.$class("atTop");
sandbox.clock.tick(1750);
expect($upDownControls).to.have.$class("transitionComplete");
expect($upDownControls).to.not.have.$class("startTransition");
});
it("should have startTransition and then transitionComplete as a class after leaving " +
"atBottom", function () {
var $vertCarouselContainer = $("#vert-carousel-test"),
$upDownControls = $vertCarouselContainer.parent().find(".js-up-down-controls");
sandbox.useFakeTimers();
$vertCarouselContainer.addClass("js-vertical-carousel-main-container");
carousel = AthVertExpandingCarousel.init($vertCarouselContainer, {maxRows: 2});
$upDownControls.find(".js-down-controls").click().click();
sandbox.clock.tick(1750);
$upDownControls.find(".js-up-controls").click();
expect($upDownControls).to.have.$class("startTransition");
expect($upDownControls).to.not.have.$class("transitionComplete");
expect($upDownControls).to.not.have.$class("atBottom");
sandbox.clock.tick(1750);
expect($upDownControls).to.have.$class("transitionComplete");
expect($upDownControls).to.not.have.$class("startTransition");
});
});
});
});
});
});
我有一组非常相似的测试,他们正在工作,但这些可能有问题:
type
TMyComponent = class(TControl)
private
FParentLastWidth: integer;
...
procedure Invalidate; override;
...
end;
procedure TMyComponent.Invalidate;
begin
if (Parent <> nil) and (FParentLastWidth <> Parent.Width) then
begin
FParentLastWidth := Parent.Width;
// do whatever when the parent resizes
end;
inherited;
end;
答案 0 :(得分:0)
一位同事帮助我意识到我在两个不同的.spec文件中使用了相同的“describe”字符串:
describe("athena-vertical-expanding-carousel", function () {
我不知道幻影,jenkins等可以配置得如此严格以防止重复标签,但这是有道理的。
我无法找到stackoverflow问题到这个确切的错误,所以我希望这会有所帮助。