| 1892 | } ); |
| 1893 | |
| 1894 | function getUniqueSortFixtures() { |
| 1895 | var i, |
| 1896 | detached = [], |
| 1897 | body = document.body, |
| 1898 | fixture = document.getElementById( "qunit-fixture" ), |
| 1899 | detached1 = document.createElement( "p" ), |
| 1900 | detached2 = document.createElement( "ul" ), |
| 1901 | detachedChild = detached1.appendChild( document.createElement( "a" ) ), |
| 1902 | detachedGrandchild = detachedChild.appendChild( document.createElement( "b" ) ); |
| 1903 | |
| 1904 | for ( i = 0; i < 12; i++ ) { |
| 1905 | detached.push( document.createElement( "li" ) ); |
| 1906 | detached[ i ].id = "detached" + i; |
| 1907 | detached2.appendChild( document.createElement( "li" ) ).id = "detachedChild" + i; |
| 1908 | } |
| 1909 | |
| 1910 | return { |
| 1911 | "Empty": { |
| 1912 | input: [], |
| 1913 | expected: [] |
| 1914 | }, |
| 1915 | "Single-element": { |
| 1916 | input: [ fixture ], |
| 1917 | expected: [ fixture ] |
| 1918 | }, |
| 1919 | "No duplicates": { |
| 1920 | input: [ fixture, body ], |
| 1921 | expected: [ body, fixture ] |
| 1922 | }, |
| 1923 | "Duplicates": { |
| 1924 | input: [ body, fixture, fixture, body ], |
| 1925 | expected: [ body, fixture ] |
| 1926 | }, |
| 1927 | "Detached": { |
| 1928 | input: detached.slice( 0 ), |
| 1929 | expected: detached.slice( 0 ) |
| 1930 | }, |
| 1931 | "Detached children": { |
| 1932 | input: [ |
| 1933 | detached2.childNodes[ 3 ], |
| 1934 | detached2.childNodes[ 0 ], |
| 1935 | detached2.childNodes[ 2 ], |
| 1936 | detached2.childNodes[ 1 ] |
| 1937 | ], |
| 1938 | expected: [ |
| 1939 | detached2.childNodes[ 0 ], |
| 1940 | detached2.childNodes[ 1 ], |
| 1941 | detached2.childNodes[ 2 ], |
| 1942 | detached2.childNodes[ 3 ] |
| 1943 | ] |
| 1944 | }, |
| 1945 | "Attached/detached mixture": { |
| 1946 | input: [ detached1, fixture, detached2, document, detachedChild, body, detachedGrandchild ], |
| 1947 | expected: [ document, body, fixture ], |
| 1948 | length: 3 |
| 1949 | } |
| 1950 | }; |
| 1951 | } |