username@email.com
2025-04-27 15eb82df2d6ec539e9d4245bfe08d531e8eb6379
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
describe('inheritedAttributes (option)', () => {
  it('should inherit the `crossOrigin` and `referrerPolicy` attributes', (done) => {
    const image = window.createImage({
      crossOrigin: '',
      referrerPolicy: 'no-referrer',
    });
    const viewer = new Viewer(image, {
      inline: true,
 
      viewed(event) {
        expect(event.detail.image.getAttribute('crossOrigin')).to.equal('');
        expect(event.detail.image.crossOrigin).to.equal('anonymous');
        expect(event.detail.image.getAttribute('referrerPolicy')).to.equal('no-referrer');
        expect(event.detail.image.referrerPolicy).to.equal('no-referrer');
        done();
      },
    });
 
    expect(viewer.options.inheritedAttributes).to.include('crossOrigin');
    expect(viewer.options.inheritedAttributes).to.include('referrerPolicy');
  });
 
  it('should not inherit the `crossOrigin` and `referrerPolicy` attributes', (done) => {
    const image = window.createImage({
      crossOrigin: '',
      referrerPolicy: 'no-referrer',
    });
    const viewer = new Viewer(image, {
      inheritedAttributes: [],
      inline: true,
 
      viewed(event) {
        expect(event.detail.image.getAttribute('crossOrigin')).to.be.null;
        expect(event.detail.image.crossOrigin).to.be.null;
        expect(event.detail.image.getAttribute('referrerPolicy')).to.be.null;
        expect(event.detail.image.referrerPolicy).to.equal('');
        done();
      },
    });
 
    expect(viewer.options.inheritedAttributes).to.be.empty;
  });
});