update to v2.2.1
fix type issues with root object wrapping node or querySelector fix incorrect import in demo fix unused options in vite.config.js add (some) tests - more to come!
This commit is contained in:
32
src/__tests__/fluent-dom-esm.test.ts
Normal file
32
src/__tests__/fluent-dom-esm.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import $d from "../fluent-dom-esm";
|
||||
|
||||
describe("fluent-dom-esm tests", () => {
|
||||
it("should allow for wrapping an existing node", () => {
|
||||
const $body = $d(document.body);
|
||||
$d(document.body).app($d.c("div").cls("test-class").t("text content"));
|
||||
expect($body.toDom()?.innerHTML).toEqual(
|
||||
'<div class="test-class">text content</div>',
|
||||
);
|
||||
expect(document.body?.innerHTML).toEqual(
|
||||
'<div class="test-class">text content</div>',
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow for wrapping an existing node via a querySelector for an ID", () => {
|
||||
$d(document.body)
|
||||
.app($d.c("div").id("item1").t("Item 1"))
|
||||
.app($d.c("div").id("item2").t("Item 2"))
|
||||
.app($d.c("div").id("item3").cls("item-num3").t("Item 3"));
|
||||
expect($d("#item2").toDom()).toHaveTextContent("Item 2");
|
||||
expect($d("#item3").toDom()).toHaveClass("item-num3");
|
||||
});
|
||||
|
||||
it("should append text provided via `.text()`", () => {
|
||||
const testVal = "testing 123";
|
||||
expect($d.c("div").t(testVal).toDom()).toHaveTextContent(testVal);
|
||||
});
|
||||
});
|
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* fluent-dom-esm v2.2.0
|
||||
* fluent-dom-esm v2.2.1
|
||||
*
|
||||
* Fluent DOM Manipulation, adapted to ESM and cranked up to v2.1(.0).
|
||||
* Fluent DOM Manipulation, adapted to ESM and cranked up to v2.2(.1).
|
||||
*
|
||||
* https://git.itsericwoodward.com/eric/fluent-dom-esm
|
||||
*
|
||||
* v2.2.0 Copyright (c) 2025 Eric Woodward
|
||||
* v2.2.1 Copyright (c) 2025 Eric Woodward
|
||||
* Original copyright (c) 2009 Tommy Montgomery (https://glacius.tmont.com/articles/fluent-dom-manipulation-in-javascript)
|
||||
*
|
||||
* Released under the WTFPL (Do What the Fuck You Want to Public License)
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
isString,
|
||||
} from "./fluent-dom-esm.type-guards";
|
||||
|
||||
const APP_VERSION = "2.2.0";
|
||||
const APP_VERSION = "2.2.1";
|
||||
|
||||
/**
|
||||
* IIFE that creates the FluentDomObject as default export
|
||||
|
@@ -1,4 +1,5 @@
|
||||
export interface FluentDomObject {
|
||||
(nodeOrQuerySelector: string | HTMLElement): FluentDomObject;
|
||||
fluentDom: string;
|
||||
|
||||
a: (name: string, value: string) => FluentDomObject;
|
||||
|
Reference in New Issue
Block a user