some renaming of variables
All checks were successful
Build, test and publish / verify (push) Successful in 5m55s
All checks were successful
Build, test and publish / verify (push) Successful in 5m55s
This commit is contained in:
@@ -80,7 +80,7 @@ describe('EntityEditor', () => {
|
||||
appearances: { REGULAR: 2, SELECTION: 2, PRE_SCHOOLER: 1, SHOW_CASE: 2, PRE_EDUCATION: 2 },
|
||||
};
|
||||
|
||||
it('defaults x to two and rejects duplicate dated dayparts and fractional x', () => {
|
||||
it('defaults preferredDayParts to two and rejects duplicate dated dayparts and fractional preferredDayParts', () => {
|
||||
const component = editor({ kind: 'show' });
|
||||
component.name = 'Show';
|
||||
expect(component.validDetails()).toBe(true);
|
||||
@@ -99,7 +99,27 @@ describe('EntityEditor', () => {
|
||||
expect(component.validDetails()).toBe(false);
|
||||
});
|
||||
|
||||
it('retains x when dayparts are removed so it can be explicitly corrected', () => {
|
||||
it('preserves an explicitly chosen preferredDayParts when adding dayparts to a new show', async () => {
|
||||
api.saveShow.mockReturnValue(of(show));
|
||||
const component = editor({ kind: 'show' });
|
||||
component.name = 'Show';
|
||||
component.addPart();
|
||||
component.dayParts[0].date = '2027-06-01';
|
||||
component.addPart();
|
||||
component.dayParts[1].date = '2027-06-02';
|
||||
component.preferredDayParts = 1;
|
||||
component.addPart();
|
||||
component.dayParts[2].date = '2027-06-03';
|
||||
expect(component.preferredDayParts).toBe(1);
|
||||
await component.save();
|
||||
expect(api.saveShow).toHaveBeenCalledWith(
|
||||
7,
|
||||
expect.objectContaining({ preferredDayParts: 1 }),
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
it('retains preferredDayParts when dayparts are removed so it can be explicitly corrected', () => {
|
||||
const component = editor({ kind: 'show', value: show });
|
||||
component.addPart();
|
||||
component.dayParts[2].date = '2027-06-03';
|
||||
@@ -144,7 +164,7 @@ describe('EntityEditor', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('displays one editable x field with a default of one for a one-daypart show', async () => {
|
||||
it('displays one editable preferredDayParts field with a default of one for a one-daypart show', async () => {
|
||||
// jsdom does not implement native dialog opening.
|
||||
const descriptor = Object.getOwnPropertyDescriptor(HTMLDialogElement.prototype, 'showModal');
|
||||
Object.defineProperty(HTMLDialogElement.prototype, 'showModal', {
|
||||
|
||||
Reference in New Issue
Block a user