1

このようなテストケースを実行すると、テスト結果がYUIテストコンソールウィジェット内に表示されます。

YUI({debug: true}).use('test', 'event-base', 'test-console', function (Y) {
    fooTests = new Y.Test.Case({
        name: "foo",
        testFoo: function () {
            Y.assert(5 == 6);
        }
    });    

    Y.on("domready", function () {
        (new Y.Test.Console({
            newestOnTop: false,
            style: 'block'
        })).render('#log');
        Y.Test.Runner.add(fooTests);
        Y.Test.Runner.run();
    });
});

まったく同じコードを実行したが、最初に「test」を使用する別のYUIインスタンスを作成した場合、テストはブラウザーのjavascriptコンソールに表示されます(開いている場合)。

YUI({debug: true}).use('test', function (Y) {

});

YUI({debug: true}).use('test', 'event-base', 'test-console', function (Y) {
    fooTests = new Y.Test.Case({
        name: "foo",
        testFoo: function () {
            Y.assert(5 == 6);
        }
    });    

    Y.on("domready", function () {
        (new Y.Test.Console({
            newestOnTop: false,
            style: 'block'
        })).render('#log');
        Y.Test.Runner.add(fooTests);
        Y.Test.Runner.run();
    });
});

'test'が別のYUIインスタンスで使用されている場合に、結果をtest-consoleウィジェットに表示する方法はありますか?

4

1 に答える 1

1

ここで答えを見つけました。

追加しなければなりませんでした

logSource: Y.Global

Test.Console のパラメーター オブジェクトへ。

   (new Y.Test.Console({
        logSource: Y.Global,
        newestOnTop: false,
        style: 'block'
    })).render('#log');
于 2013-03-13T22:49:52.397 に答える