"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const ThemeColors_1 = require("./ThemeColors");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const themeColorsAo = appObjects.getOrCreate("ThemeColors");
    const theme = (0, ThemeColors_1.makeThemeColors)(themeColorsAo);
    const observer = jest.fn();
    theme.addChangeObserver(observer);
    return { theme, observer };
}
describe("Theme Colors Entity", () => {
    it("Initialzes the color", () => {
        const { theme } = makeTestRig();
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.primary)).toEqual(core_2.Color.Hex("#00668A"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimary)).toEqual(core_2.Color.Hex("#FFFFFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.primaryContainer)).toEqual(core_2.Color.Hex("#C4E7FF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimaryContainer)).toEqual(core_2.Color.Hex("#001E2C"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.primaryFixed)).toEqual(core_2.Color.Hex("#C4E7FF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimaryFixed)).toEqual(core_2.Color.Hex("#001E2C"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.primaryFixedDim)).toEqual(core_2.Color.Hex("#7BD0FF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimaryFixedVariant)).toEqual(core_2.Color.Hex("#004C69"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.secondary)).toEqual(core_2.Color.Hex("#4E616D"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSecondary)).toEqual(core_2.Color.Hex("#FFFFFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.secondaryContainer)).toEqual(core_2.Color.Hex("#D1E5F4"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSecondaryContainer)).toEqual(core_2.Color.Hex("#0A1E28"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSecondaryFixed)).toEqual(core_2.Color.Hex("#0A1E28"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.secondaryFixedDim)).toEqual(core_2.Color.Hex("#B5C9D7"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSecondaryFixedVariant)).toEqual(core_2.Color.Hex("#374955"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.tertiary)).toEqual(core_2.Color.Hex("#605A7D"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onTertiary)).toEqual(core_2.Color.Hex("#FFFFFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.tertiaryContainer)).toEqual(core_2.Color.Hex("#E6DEFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onTertiaryContainer)).toEqual(core_2.Color.Hex("#1D1736"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.tertiaryFixed)).toEqual(core_2.Color.Hex("#E6DEFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onTertiaryFixed)).toEqual(core_2.Color.Hex("#1D1736"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.tertiaryFixedDim)).toEqual(core_2.Color.Hex("#CAC1E9"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onTertiaryFixedVariant)).toEqual(core_2.Color.Hex("#484264"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.error)).toEqual(core_2.Color.Hex("#BA1A1A"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onError)).toEqual(core_2.Color.Hex("#FFFFFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.errorContainer)).toEqual(core_2.Color.Hex("#FFDAD6"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onErrorContainer)).toEqual(core_2.Color.Hex("#410002"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.outline)).toEqual(core_2.Color.Hex("#71787D"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.background)).toEqual(core_2.Color.Hex("#FBFCFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onBackground)).toEqual(core_2.Color.Hex("#191C1E"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surface)).toEqual(core_2.Color.Hex("#F8F9FC"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSurface)).toEqual(core_2.Color.Hex("#191C1E"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceVariant)).toEqual(core_2.Color.Hex("#DCE3E9"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onSurfaceVariant)).toEqual(core_2.Color.Hex("#41484D"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.inverseSurface)).toEqual(core_2.Color.Hex("#2E3133"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.inverseOnSurface)).toEqual(core_2.Color.Hex("#F0F1F3"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.inversePrimary)).toEqual(core_2.Color.Hex("#7BD0FF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.shadow)).toEqual(core_2.Color.Hex("#000000"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceTint)).toEqual(core_2.Color.Hex("#00668A"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.outlineVariant)).toEqual(core_2.Color.Hex("#C0C7CD"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.scrim)).toEqual(core_2.Color.Hex("#000000"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceContainerHighest)).toEqual(core_2.Color.Hex("#E1E2E5"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceContainerHigh)).toEqual(core_2.Color.Hex("#E7E8EA"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceContainer)).toEqual(core_2.Color.Hex("#EDEEF0"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceContainerLow)).toEqual(core_2.Color.Hex("#F3F3F6"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceContainerLowest)).toEqual(core_2.Color.Hex("#FFFFFF"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceBright)).toEqual(core_2.Color.Hex("#F8F9FC"));
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.surfaceDim)).toEqual(core_2.Color.Hex("#D9DADC"));
    });
    it("Sets the color for a type and notifies", () => {
        const { theme, observer } = makeTestRig();
        const c = core_2.Color.RGB(10, 20, 30);
        theme.setColorForType(ThemeColors_1.ThemeColorType.onBackground, c);
        theme.setColorForType(ThemeColors_1.ThemeColorType.onBackground, c);
        theme.setColorForType(ThemeColors_1.ThemeColorType.onBackground, c);
        theme.setColorForType(ThemeColors_1.ThemeColorType.onBackground, c);
        expect(observer).toHaveBeenCalledTimes(1);
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onBackground)).toEqual(c);
    });
    it("Sets the color by hex for a type and notifies", () => {
        const { theme, observer } = makeTestRig();
        theme.setColorHexForType(ThemeColors_1.ThemeColorType.onBackground, "#00668a");
        theme.setColorHexForType(ThemeColors_1.ThemeColorType.onBackground, "#00668a");
        theme.setColorHexForType(ThemeColors_1.ThemeColorType.onBackground, "#00668a");
        theme.setColorHexForType(ThemeColors_1.ThemeColorType.onBackground, "#00668a");
        expect(observer).toHaveBeenCalledTimes(1);
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onBackground).hex).toEqual("#00668a");
    });
    it("Sets the colors by hex for a set of colors and notifies", () => {
        const { theme, observer } = makeTestRig();
        const colorSet = new Map();
        colorSet.set(ThemeColors_1.ThemeColorType.onBackground, "00668a");
        colorSet.set(ThemeColors_1.ThemeColorType.onPrimary, "00668b");
        colorSet.set(ThemeColors_1.ThemeColorType.onPrimaryContainer, "00668c");
        colorSet.set(ThemeColors_1.ThemeColorType.onPrimaryFixedVariant, "00668d");
        theme.setColorHexForSet(colorSet);
        expect(observer).toHaveBeenCalledTimes(4);
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onBackground).hex).toEqual("#00668a");
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimary).hex).toEqual("#00668b");
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimaryContainer).hex).toEqual("#00668c");
        expect(theme.getColorForType(ThemeColors_1.ThemeColorType.onPrimaryFixedVariant).hex).toEqual("#00668d");
    });
});
//# sourceMappingURL=ThemeColors.test.js.map