Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 60545f1

Browse files
committed
test(linky): account for variable attribute order
1 parent 79264c8 commit 60545f1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/ngSanitize/filter/linkySpec.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,22 @@ describe('linky', function() {
6161

6262
it('should optionally add custom attributes', function() {
6363
expect(linky("http://example.com", "_self", {rel: "nofollow"})).
64-
toEqual('<a rel="nofollow" target="_self" href="http://example.com">http://example.com</a>');
64+
toBeOneOf('<a rel="nofollow" target="_self" href="http://example.com">http://example.com</a>',
65+
'<a href="http://example.com" target="_self" rel="nofollow">http://example.com</a>');
6566
});
6667

6768

6869
it('should override target parameter with custom attributes', function() {
6970
expect(linky("http://example.com", "_self", {target: "_blank"})).
70-
toEqual('<a target="_blank" href="http://example.com">http://example.com</a>');
71+
toBeOneOf('<a target="_blank" href="http://example.com">http://example.com</a>',
72+
'<a href="http://example.com" target="_blank">http://example.com</a>');
7173
});
7274

7375

7476
it('should optionally add custom attributes from function', function() {
7577
expect(linky("http://example.com", "_self", function(url) {return {"class": "blue"};})).
76-
toEqual('<a class="blue" target="_self" href="http://example.com">http://example.com</a>');
78+
toBeOneOf('<a class="blue" target="_self" href="http://example.com">http://example.com</a>',
79+
'<a href="http://example.com" target="_self" class="blue">http://example.com</a>');
7780
});
7881

7982

@@ -86,7 +89,8 @@ describe('linky', function() {
8689

8790
it('should strip unsafe attributes', function() {
8891
expect(linky("http://example.com", "_self", {"class" : "blue", "onclick": "alert('Hi')"})).
89-
toEqual('<a class="blue" target="_self" href="http://example.com">http://example.com</a>');
92+
toBeOneOf('<a class="blue" target="_self" href="http://example.com">http://example.com</a>',
93+
'<a href="http://example.com" target="_self" class="blue">http://example.com</a>');
9094
});
9195
});
9296
});

0 commit comments

Comments
 (0)