Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/fg-loadcss/test/qunit/ |
Upload File : |
/*global window:true*/ (function(window) { /* ======== A Handy Little QUnit Reference ======== http://api.qunitjs.com/ Test methods: module(name, {[setup][ ,teardown]}) test(name, callback) expect(numberOfAssertions) stop(increment) start(decrement) Test assertions: ok(value, [message]) equal(actual, expected, [message]) notEqual(actual, expected, [message]) deepEqual(actual, expected, [message]) notDeepEqual(actual, expected, [message]) strictEqual(actual, expected, [message]) notStrictEqual(actual, expected, [message]) throws(block, [expected], [message]) */ // initial value of media attr var initialMedia = "only x"; test( 'function loadCSS exists', function(){ expect(2); ok( window.loadCSS, "loadCSS should exist on the window object" ); ok( typeof window.loadCSS === "function", "loadCSS should be a function" ); }); asyncTest( 'loadCSS loads a CSS file', function(){ expect(1); var ss = loadCSS("files/test.css"); onloadCSS( ss, function(){ ok("stylesheet loaded successfully"); start(); }); }); asyncTest( 'loadCSS loads a CSS file with a relative path', function(){ expect(1); var ss = loadCSS("../../test/qunit/files/test.css"); onloadCSS( ss, function(){ ok("stylesheet loaded successfully"); start(); }); }); asyncTest( 'loadCSS loads a CSS file with specific attributes', function(){ expect(3); var attributes = { title: "Default Style", type: "text/css" }; var ss = loadCSS("files/test.css", null, null, attributes); onloadCSS( ss, function(){ ok("stylesheet loaded successfully"); equal(ss.title, attributes.title, "'title' attribute should be '" + attributes.title + "'"); equal(ss.type, attributes.type, "'type' attribute should be '" + attributes.type + "'"); start(); }); }); asyncTest( 'loadCSS sets media type before and after the stylesheet is loaded', function(){ expect(2); var ss = loadCSS("files/test.css"); ok(ss.media, initialMedia, "media type begins as" + initialMedia ); onloadCSS( ss, function(){ equal(ss.media, "all", "media type is all"); start(); }); }); asyncTest( 'loadCSS sets media type to a custom value if specified, after load', function(){ expect(2); var med = "print"; var ss = loadCSS("files/test.css", null, med); ok(ss.media, initialMedia, "media type begins as " + initialMedia ); onloadCSS( ss, function(){ equal(ss.media, med, "media type is " + med); start(); }); }); test( 'loadCSS injects before a particular specified element', function(){ expect(1); var elem = window.document.getElementById("before-test"); var ss = loadCSS("files/test.css", elem); equal(ss.nextElementSibling, elem ); }); asyncTest( 'onloadCSS callback fires after css is loaded', function(){ expect(1); var getStyles = window.getComputedStyle ? function (node) { return window.getComputedStyle(node, null); } : function (node) { return node.currentStyle; }; var elem = window.document.createElement("div"); elem.className = "bar"; document.body.appendChild( elem ); var ss = loadCSS("files/test.css?1"); onloadCSS( ss, function(){ equal(getStyles(elem).backgroundColor, 'rgb(0, 128, 0)', 'background is green' ); start(); } ); }); test( 'loadCSS preload polyfill methods ', function(){ expect(5); ok( window.loadCSS.relpreload, "loadCSS.relpreload should exist" ); ok( typeof window.loadCSS.relpreload === "object", "relpreload should be an object" ); ok( typeof window.loadCSS.relpreload.support === "function", "relpreload.support should be a function" ); ok( typeof window.loadCSS.relpreload.poly === "function", "relpreload.poly should be a function" ); ok( typeof window.loadCSS.relpreload.support() === "boolean", "relpreload.support should be a bool" ); }); }(window));