• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

excaliburjs / Excalibur / 7294397098

21 Dec 2023 11:56PM UTC coverage: 91.859% (-0.06%) from 91.915%
7294397098

push

github

web-flow
fix: #2848 Sprite tint respected in constructor (#2852)

Closes #2848 

## Changes:

- Fixes sprite tint constructor value passing
- Fixes sprite tint on cloned sprites
- Fixes width/height inconsistency discovered in new tests
- New tests

4602 of 5758 branches covered (0.0%)

7 of 7 new or added lines in 3 files covered. (100.0%)

7 existing lines in 2 files now uncovered.

10686 of 11633 relevant lines covered (91.86%)

27166.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/src/engine/Configurable.ts
1
export type Constructor<T> = {
2
  new (...args: any[]): T;
3
};
4
/**
5
 * Configurable helper extends base type and makes all properties available as option bag arguments
6
 * @internal
7
 * @param base
8
 */
9
export function Configurable<T extends Constructor<{}>>(base: T): T {
10
  return class extends base {
1✔
11
    public assign(props: Partial<T>) {
12
      //set the value of every property that was passed in,
13
      //if the constructor previously set this value, it will be overridden here
14
      for (const k in props) {
×
15
        // eslint-disable-next-line
16
        if (typeof (<any>this)[k] !== 'function') {
×
17
          // eslint-disable-next-line
18
          (<any>this)[k] = (<any>props)[k];
×
19
        }
20
      }
21
    }
22

23
    constructor(...args: any[]) {
24
      super(...args);
72✔
25
      //get the number of arguments that aren't undefined. TS passes a value to all parameters
26
      //of whatever ctor is the implementation, so args.length doesn't work here.
27
      const size = args.filter(function(value) {
72✔
28
        return value !== undefined;
720✔
29
      }).length;
30
      if (size === 1 && args[0] && typeof args[0] === 'object' && !(args[0] instanceof Array)) {
72!
31
        this.assign(args[0]);
×
32
      }
33
    }
34
  };
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc