mindmap / TESTING_MMAP.md
manhteky123's picture
Upload 401 files
a771826 verified
# Hướng dẫn test với file mmap.txt
## Bước 1: Tạo file .mmap từ XML
File `mmap.txt` của bạn chứa XML thuần. Để test tính năng import, bạn cần tạo file .mmap đúng định dạng (ZIP archive):
### Cách 1: Sử dụng script Python
```python
import zipfile
import os
# Đọc XML từ file
with open('mmap.txt', 'r', encoding='utf-8') as f:
xml_content = f.read()
# Tạo file .mmap (ZIP)
with zipfile.ZipFile('test.mmap', 'w', zipfile.ZIP_DEFLATED) as zipf:
# Thêm XML vào ZIP với tên Document.xml
zipf.writestr('Document.xml', xml_content)
print("Created test.mmap successfully!")
```
Chạy: `python create_mmap.py`
### Cách 2: Thủ công với WinRAR/7-Zip
1. Đổi tên `mmap.txt` thành `Document.xml`
2. Nén file `Document.xml` bằng WinRAR hoặc 7-Zip
3. Đổi extension file nén từ `.zip` thành `.mmap`
### Cách 3: PowerShell (Windows)
```powershell
# Đọc XML
$xmlContent = Get-Content -Path "mmap.txt" -Raw -Encoding UTF8
# Tạo thư mục tạm
$tempDir = "temp_mmap"
New-Item -ItemType Directory -Path $tempDir -Force
# Lưu XML với tên Document.xml
$xmlContent | Out-File -FilePath "$tempDir\Document.xml" -Encoding UTF8
# Tạo ZIP
Compress-Archive -Path "$tempDir\*" -DestinationPath "test.zip" -Force
# Đổi thành .mmap
Move-Item -Path "test.zip" -Destination "test.mmap" -Force
# Dọn dẹp
Remove-Item -Path $tempDir -Recurse -Force
Write-Host "Created test.mmap successfully!"
```
Chạy trong PowerShell: `.\create_mmap.ps1`
## Bước 2: Test import
1. Khởi động ứng dụng:
```bash
npm run start
```
2. Mở trình duyệt tại `http://localhost:4200`
3. Click Menu (☰) > Open > Import MindManager (.mmap)
4. Chọn file `test.mmap` đã tạo
5. Mind map của bạn sẽ hiển thị!
## Bước 3: Debug (nếu cần)
Mở Developer Console (F12) để xem log:
- Nếu thành công: sẽ thấy các elements được tạo
- Nếu lỗi: sẽ có error message chi tiết
## Ví dụ kết quả mong đợi
Từ file XML của bạn, sẽ tạo ra:
- 1 rectangle "KẾ HOẠCH GIÁO DỤC LỚP 4 - 5 TUỔI B" (center topic)
- Các rectangles cho các topics con:
- "ĐẶC ĐIỂM TÌNH HÌNH LỚP"
- "KẾ HOẠCH GIÁO DỤC NĂM"
- "KẾ HOẠCH GIÁO DỤC THÁNG"
- "KẾ HOẠCH HOẠT ĐỘNG VUI CHƠI"
- "THEO DÕI HỌC SINH"
- "ĐÁNH GIÁ TRẺ"
- Lines kết nối giữa các topics